コード例 #1
0
 public ChatServerMenuItem(JabberID jid, MultiUserChatForm parentForm)
     : base(jid.ToString())
 {
     base.Click +=new EventHandler(ChatServerMenuItem_Click);
     _myJID = jid;
     _myForm = parentForm;
 }
コード例 #2
0
ファイル: ChatRoomTabPage.cs プロジェクト: weijunbao/chatapp
        public ChatRoomTabPage(JabberID occupantJID, MultiUserChatForm form, SessionManager sm)
            : base(occupantJID.BareJID.ToString())
        {
            _occupant = occupantJID;
            _form = form;
            _sm = sm;

            _sm.Session.AddHandler(typeof(MessageErrorPacket), new Session.PacketReceivedDelegate(IncomingMessage));
            _sm.Session.AddHandler(typeof(GroupChatMessage), new Session.PacketReceivedDelegate(IncomingMessage));
            _sm.Session.AddHandler(typeof(ChangeSubjectMessage), new Session.PacketReceivedDelegate(IncomingMessage));
            _sm.Session.AddHandler(typeof(AvailableRequest), new Session.PacketReceivedDelegate(IncomingPresence));
            _sm.Session.AddHandler(typeof(ErrorResponse), new Session.PacketReceivedDelegate(IncomingPresence));
            _sm.Session.AddHandler(typeof(OccupantAvailableResponse), new Session.PacketReceivedDelegate(IncomingPresence));
            _sm.Session.AddHandler(typeof(OccupantUnavailableResponse), new Session.PacketReceivedDelegate(IncomingPresence));
        }
コード例 #3
0
ファイル: SessionManager.cs プロジェクト: weijunbao/chatapp
        public void LoadChatRooms()
        {
            if (_multiUserChat == null)
            {
                _multiUserChat = new MultiUserChatForm(this);
                _multiUserChat.Show();
            }
            else
                if (!_multiUserChat.Visible)
                {
                    _multiUserChat = new MultiUserChatForm(this);
                    _multiUserChat.Show();
                }

            _multiUserChat.Focus();
        }
コード例 #4
0
ファイル: RoomCommands.cs プロジェクト: weijunbao/chatapp
        public static bool ProcessGlobalMessage(string msg, MultiUserChatForm _form)
        {
            try
            {
                if (msg.StartsWith(Join))
                {
                    JabberID jid = JabberID.Parse(msg.Substring(Join.Length));

                    if (! jid.IsFullJID())
                        throw new ArgumentException("The JabberID must be a full JabberID in the form of room@service/nick");

                    _form.JoinRoom(jid);
                }
                else if ( msg.StartsWith(Quit) || msg.StartsWith(RoomCommands.Exit) )
                    _form.Close();
                else if ( msg.StartsWith(Help) )
                    _form.txtHistory.AppendText(GetHelpText());
                else
                    return false;

                return true;
            }
            catch ( Exception ex)
            {
                MessageBox.Show(string.Concat("Error processing command: ", ex.Message));
                return false;
            }
        }