コード例 #1
0
        public async Task SendPresenceAsync()
        {
            var pres = new Presence();

            pres.Add(clientCaps.ClientCapabilities);

            await xmppClient.SendPresenceAsync(pres);
        }
コード例 #2
0
        public async Task SendPresenceAsync(ViewModel.OnlineStatus status)
        {
            var pres = new Presence
            {
                Show = mapper.Map <Matrix.Xmpp.Show>(status)
            };

            pres.Add(clientCaps.ClientCapabilities);
            await xmppClient.SendPresenceAsync(pres);
        }
コード例 #3
0
        public Presence CreateEnterRoomStanza(Jid room, string nickname, string password = null, bool disableHistory = false, History history = null)
        {
            var to = new Jid(room.ToString())
            {
                Resource = nickname
            };

            var pres = new Presence
            {
                To = to
            };

            var x = new X();

            if (password != null)
            {
                x.Password = password;
            }

            if (disableHistory)
            {
                var hist = new History {
                    MaxCharacters = 0
                };
                x.History = hist;
            }

            if (history != null)
            {
                x.History = history;
            }

            pres.Add(x);

            return(pres);
        }
コード例 #4
0
        public async Task JoinRoom(string roomJid)
        {
            string nickname;
            bool   found = Config.GetString("JABBER_NICKNAME", out nickname);

            if (!found)
            {
                nickname = "Sansha_Kuvakei";
            }

            Jid to = new Jid(roomJid)
            {
                Resource = nickname
            };

            Presence p = new Presence()
            {
                To = to
            };

            p.Nick = new Matrix.Xmpp.Nickname.Nick(nickname);

            var x = new X();

            x.History = new History();
            // Suppress history, we don't want to process old messages
            x.History.MaxStanzas = 0;
            p.Add(x);

            AddRoom(to.User);

            await m_client.SendAsync(p);


            Console.WriteLine("[Info] Joined room {0}", roomJid);
        }
コード例 #5
0
        public static void AddPresence(common.Presence t)
        {
            Presence presence = Mapper.Casting(t);

            Presence.Add(presence);
        }