Esempio n. 1
0
        public override void CloseChat(FrontendManager fm, ChatModel chat)
        {
            Trace.Call(fm, chat);

            if (chat.ChatType == ChatType.Group)
            {
                _ConferenceManager.GetRoom(chat.ID + "/" + _JabberClient.User).Leave("Closed");
            }
            else
            {
                Session.RemoveChat(chat);
            }
        }
        public void HasRoomTest()
        {
            cm        = new ConferenceManager();
            cm.Stream = stream;

            bool roomExists = cm.HasRoom(jid);

            Assert.IsFalse(roomExists);

            cm.GetRoom(jid);
            roomExists = cm.HasRoom(jid);
            Assert.IsTrue(roomExists);
        }
Esempio n. 3
0
        private static void Client_OnAuthenticate(object sender)
        {
            Console.WriteLine("Authed!\nJID: " + client.JID + "\nServer: " + client.Server);
            JID room = new JID(username, "chat.livecoding.tv", UppercaseFirst(username));
            ConferenceManager manager = new ConferenceManager {
                Stream = client
            };

            r                = manager.GetRoom(room.User + "@" + room.Server + "/" + room.Resource);
            r.OnJoin        += R_OnJoin;
            r.OnRoomMessage += R_OnRoomMessage;
            r.Join();
        }
Esempio n. 4
0
        private void joinConferenceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ConferenceForm cf = new ConferenceForm();

            cf.DiscoManager = dm;
            cf.Nick         = jc.JID.User;
            if (cf.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            muc.GetRoom(cf.RoomAndNick).Join();
        }
        private Room CreateRoomPlayback(bool joinRoom, Func <Room, Room> alterRoom)
        {
            cm        = new ConferenceManager();
            cm.Stream = stream;

            Room testRoom = cm.GetRoom(jid);

            alterRoom(testRoom);
            if (joinRoom)
            {
                testRoom.Join();
            }

            return(testRoom);
        }
Esempio n. 6
0
        private void hlp_DiscoHandler_SubscribeToRooms(DiscoManager sender, DiscoNode node, object state)
        {
            if (node == null)
            {
                return;
            }

            if (node.Children != null && _subscribedRooms == "@all")
            {
                foreach (DiscoNode dn in node.Children)
                {
                    Logger.Info(string.Format("Subscribing to: '{0}':'{1}' on '{2}'", dn.JID, dn.Name, _jabberClient.Server));
                    // we have to build a new JID here, with the nickname included http://xmpp.org/extensions/xep-0045.html#enter-muc
                    JID  subscriptionJid = new JID(dn.JID.User, dn.JID.Server, "AutoBot .");
                    Room room            = _conferenceManager.GetRoom(subscriptionJid);
                    room.Join();
                }
            }
        }
Esempio n. 7
0
        private void GotBookmarks(object sender, IQ iq, object state)
        {
            if ((iq == null) || (iq.Type != IQType.result))
            {
                return;
            }

            Private priv = iq.Query as Private;

            if (priv == null)
            {
                return;
            }

            Bookmarks bm = priv.GetChildElement <Bookmarks>();

            if (bm == null)
            {
                return;
            }

            foreach (BookmarkConference conf in bm.GetConferences())
            {
                if (conf.JID == null)
                {
                    continue;
                }

                m_conferences[conf.JID] = conf;
                if (OnConferenceAdd != null)
                {
                    OnConferenceAdd(this, conf);
                }
                if (conf.AutoJoin && (m_confManager != null))
                {
                    JID  rJID        = conf.JID;
                    JID  roomAndNick = new JID(rJID.User, rJID.Server, conf.Nick);
                    Room r           = m_confManager.GetRoom(roomAndNick);
                    r.Join(conf.Password);
                }
            }
        }
Esempio n. 8
0
        private Room GetRoomInternal(string room)
        {
            if (_conference == null)
            {
                return(null);
            }
            var jid = new JID(room, "conference." + _serverName, _jc.JID.User);
            var r   = (Room)_rooms[jid];

            if (r != null)
            {
                return(r);
            }
            r = _conference.GetRoom(new JID(room, "conference." + _serverName, _jc.JID.User));
            if (r == null)
            {
                return(null);
            }
            _rooms[jid] = r;
            return(r);
        }