private void RunXMPP() { XMPP xmpp = new XMPP(Config.XMPP_JID, OAuthTicket.AccessToken, Config.XMPPResourceName, "X-OAUTH2", Config.XMPPUseProxy ? Config.WebProxyHost : null, Config.XMPPUseProxy ? Config.WebProxyPort : 0, Config.XMPPHost, Config.XMPPPort); xmpp.Start((ex, x) => XMPP_Ended(ex, x)); xmpp.Subscribe("cloudprint.google.com", ProcessPush); XMPP = xmpp; }
private void XMPP_Ended(Exception ex, XMPP xmpp) { if (xmpp.IsCancelled || ex == null) { OperationCancelled(this); } else if (xmpp.IsSubscribed) { RunXMPP(); } else { XMPPReconnectTimer = new Timer(new TimerCallback(XMPP_Reconnect), null, XMPPReconnectInterval, new TimeSpan(-1)); Logger.Log(LogLevel.Warning, "XMPP connection broken - exception:\n{0}", ex); } }
private void ProcessPush(XElement el, XMPP xmpp) { string printerid = Encoding.ASCII.GetString(Convert.FromBase64String(el.Value)); UpdateCloudPrintJobs(printerid); }
private void XMPP_Ended(Exception ex, XMPP xmpp) { if (xmpp.IsCancelled || ex == null) { OperationCancelled(this); } else if (xmpp.IsSubscribed) { RunXMPP(); } else { XMPPReconnectTimer = new Timer(new TimerCallback(XMPP_Reconnect), null, XMPPReconnectInterval, new TimeSpan(-1)); Logger.Log(LogLevel.Warning, "XMPP connection broken - exception:\n{0}", ex); } }
private void RunXMPP() { XMPP xmpp = new XMPP(Config.XMPP_JID, OAuthTicket.AccessToken, Config.XMPPResourceName, "X-OAUTH2", Config.XMPPUseProxy ? Config.WebProxyHost : null, Config.XMPPUseProxy ? Config.WebProxyPort : 0, Config.XMPPHost, Config.XMPPPort); xmpp.Start((ex, x) => XMPP_Ended(ex, x)); xmpp.Subscribe("cloudprint.google.com", ProcessPush); XMPP = xmpp; }
private void ProcessPush(XElement el, XMPP xmpp) { string printerid = Encoding.ASCII.GetString(Convert.FromBase64String(el.Value)); UpdateCloudPrintJobs(printerid); }