Helper class for managing presence and subscriptions
Ejemplo n.º 1
0
		private void cmdApprove_Click(object sender, System.EventArgs e)
		{
			PresenceManager pm = new PresenceManager(_connection);
			pm.ApproveSubscriptionRequest(_from);

			this.Close();
		}
Ejemplo n.º 2
0
 public XmppClientConnection()
     : base()
 {
     m_IqGrabber			= new IqGrabber(this);
     m_MessageGrabber	= new MessageGrabber(this);
     m_PresenceGrabber   = new PresenceGrabber(this);
     m_PresenceManager	= new PresenceManager(this);
     m_RosterManager		= new RosterManager(this);
 }
Ejemplo n.º 3
0
 public AuthorizationProvider(Client client, INotificationQueue queue, XmppClientConnection connection)
 {
     _client = client;
     _queue = queue;
     _presenceManager = new PresenceManager(connection);
 }
Ejemplo n.º 4
0
 public override void Initialize(IClientConnection connection)
 {
     base.Initialize(connection);
     _presenceManager = new PresenceManager(Connection);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Initialize the connection for this account
        /// </summary>
        /// <returns></returns>
        private Boolean InitializeConnection()
        {
            if (String.IsNullOrEmpty(serverName) || String.IsNullOrEmpty(username) || String.IsNullOrEmpty(password))
                return false;

            if (clientConnection != null)
            {
                clientConnection.Close();
                clientConnection = null;
                presenceManager = null;
            }

            //TODO: If the server's jid winds up not being the same as our ServerName, disconnect the connection, set the ConnectServer = ServerName, set Server = jid, set AutoResolveConnectServer = false
            //and then try to reconnect.
            clientConnection = new XmppClientConnection()
            {
                Server = serverName,
                AutoResolveConnectServer = autoResolveConnectServer,
                ConnectServer = connectServer,
                Username = username,
                Password = password,
                Port = port,
                SocketConnectionType = agsXMPP.net.SocketConnectionType.Direct,
                KeepAlive = true,
                UseSSL = useSSL,
                UseStartTLS = useTLS,
                Resource = "Jabber/XMPP",
                UseCompression = true,
                AutoAgents = true,
                AutoPresence = true,
                AutoRoster = true
            };

            clientConnection.OnXmppConnectionStateChanged += OnXmppConnectionStateChanged;
            clientConnection.OnLogin += OnLogin;
            clientConnection.OnError += OnError;
            clientConnection.OnMessage += OnMessage;
            clientConnection.OnRosterStart += OnRosterStart;
            clientConnection.OnRosterItem += OnRosterItem;
            clientConnection.OnRosterEnd += OnRosterEnd;
            clientConnection.OnAuthError += OnAuthError;
            clientConnection.OnPresence += OnPresence;

            clientConnection.OnAgentStart += clientConnection_OnAgentStart;
            clientConnection.OnAgentItem += clientConnection_OnAgentItem;
            clientConnection.OnAgentEnd += clientConnection_OnAgentEnd;
            clientConnection.OnBinded += clientConnection_OnBinded;
            clientConnection.OnClose += clientConnection_OnClose;
            clientConnection.OnIq += clientConnection_OnIq;
            clientConnection.OnSaslStart += clientConnection_OnSaslStart;
            clientConnection.OnSaslEnd += clientConnection_OnSaslEnd;
            clientConnection.OnSocketError += clientConnection_OnSocketError;
            clientConnection.OnStreamError += clientConnection_OnStreamError;
            clientConnection.OnReadSocketData += clientConnection_OnReadSocketData;
            clientConnection.OnReadXml += clientConnection_OnReadXml;
            clientConnection.OnWriteSocketData += clientConnection_OnWriteSocketData;
            clientConnection.OnWriteXml += clientConnection_OnWriteXml;
            clientConnection.ClientSocket.OnValidateCertificate += ClientSocket_OnValidateCertificate;

            presenceManager = new PresenceManager(clientConnection);

            return true;
        }
Ejemplo n.º 6
0
    public RiotChat() {
      xmpp = new XmppClientConnection {
        Server = "pvp.net",
        Port = 5223,
        ConnectServer = Session.Region.ChatServer,
        AutoResolveConnectServer = false,
        Resource = "xiff",
        UseSSL = true,
        KeepAliveInterval = 10,
        KeepAlive = true,
        UseCompression = true,
        AutoPresence = true,
        Status = new LeagueStatus(StatusMessage, Status).ToXML(),
        Show = ShowType.chat,
        Priority = 0
      };
      xmpp.OnMessage += Xmpp_OnMessage;
      xmpp.OnAuthError += (o, e) => Session.Log(e);
      xmpp.OnError += (o, e) => Session.Log(e);
      xmpp.OnLogin += o => Session.Log("Connected to chat server");
      xmpp.Open(Session.Current.Account.LoginSession.AccountSummary.Username, "AIR_" + Session.Current.Account.LoginSession.Password);

      presence = new PresenceManager(xmpp);
      roster = new RosterManager(xmpp);
      lobby = new MucManager(xmpp);

      xmpp.OnRosterEnd += o => connected = true;
      xmpp.OnRosterItem += Xmpp_OnRosterItem;
      xmpp.OnPresence += Xmpp_OnPresence;

      timer = new Timer(1000) { AutoReset = true };
      timer.Elapsed += UpdateProc;
      timer.Start();
    }