Exemple #1
0
 /// <summary>
 /// Sends the current presence information to the specified JabberID
 /// </summary>
 /// <param name="ToUser"></param>
 public void SendCurrentPresence(JabberID ToUser)
 {
     Packet p;
     if (m_currentPresence == null)
     {
         p = new UnavailableRequest();
         m_sessionMgr.BeginSend(p);
     }
     else
     {
         AvailableRequest userSpecificPresence = (AvailableRequest) m_currentPresence.Clone();
         userSpecificPresence.To = ToUser;
         userSpecificPresence.From = m_sessionMgr.LocalUser;
         p = (Packet) userSpecificPresence;
         m_sessionMgr.BeginSend(p);
     }
 }
Exemple #2
0
 //Sends the current presence information to the server
 public void SendCurrentPresence()
 {
     Packet p;
     if (_currentPresence == null)
     {
         p = new UnavailableRequest();
         this._session.BeginSend(p);
     }
     else
     {
         p = (Packet)_currentPresence.Clone();
         this._session.BeginSend(p);
     }
 }
Exemple #3
0
 //private void IncomingRosterCallback(IAsyncResult ar)
 //{
 //    RosterResponse roster = m_sessionMgr.EndSend(ar) as RosterResponse;
 //    OnIncomingRoster(roster);
 //}
 /// <summary>
 /// Event received from the SessionManager when a RosterResponse is received.
 /// When a RosterReponse is received we need to update the tree
 /// Since we're creating new GUI objects, all of that work must
 /// be done on the main thread.  We'll go ahead and build the collection
 /// of groups in this background thread and then marshall back over.
 /// </summary>
 /// <param name="incomingRosterPacket"></param>
 //private void OnIncomingRoster(RosterResponse incomingRosterPacket)
 //{
 //    //work performed in here should be done on the main GUI thread
 //    //since it will be updating the treeview
 //    m_mainWindow.Invoke(new Session.PacketReceivedDelegate(IncomingRosterThreadSafe), new object[] { incomingRosterPacket });
 //}
 /// <summary>
 /// Updates the TreeView based on the Groups of RosterItems
 /// </summary>
 /// <param name="p"></param>
 //private void IncomingRosterThreadSafe(Packet p)
 //{
 //    RosterResponse IncomingRosterPacket = p as RosterResponse;
 //    try
 //    {
 //        m_mainWindow.Cursor = System.Windows.Forms.Cursors.WaitCursor;
 //        foreach (RosterItem rsItem in IncomingRosterPacket.Items)
 //        {
 //            string groupName = rsItem.Group.ToString();
 //            TreeNode groupNode = new TreeNode(groupName);
 //            bool bAddGroup = true;
 //            foreach (TreeNode node in m_mainWindow.tvContacts.Nodes)
 //            {
 //                if (node.Text.Equals(groupName, StringComparison.OrdinalIgnoreCase))
 //                {
 //                    groupNode = node;
 //                    bAddGroup = false;
 //                    break;
 //                }
 //            }
 //            groupNode.Nodes.Add(rsItem.Name);
 //            if (bAddGroup)
 //            {
 //                m_mainWindow.tvContacts.Nodes.Add(groupNode);
 //            }
 //        }
 //    }
 //    finally
 //    {
 //        m_mainWindow.Cursor = System.Windows.Forms.Cursors.Default;
 //    }
 //}
 public void SendCurrentPresence(AvailableRequest availableRequest)
 {
     Packet packet;
     m_currentPresence = availableRequest;
     if (m_currentPresence == null || m_currentPresence.Status == "Offline")
     {
         packet = new UnavailableRequest();
         m_sessionMgr.BeginSend(packet);
     }
     else
     {
         packet = (Packet) m_currentPresence.Clone();
         m_sessionMgr.BeginSend(packet);
     }
 }
Exemple #4
0
 private void HandleUnavailable( UnavailableRequest u )
 {
     HandleUserLeftRoom ( u.From );
 }