public override void Create(string streamerUri, string id) { try { this.Status = false; this.Label = id; this.Uri = SetKeywords(streamerUri); if (int.TryParse(this.Uri, out this._chatId)) { } else { WebClient wc = new WebClient(); string s = wc.DownloadString("http://midlane.ru/channel/" + this.Uri); Regex rr = new Regex("'(.*?)[email protected]"); this._chatId = int.Parse(rr.Match(s).Groups[1].Value); } _client = new jabber.client.JabberClient(); _client.OnMessage += _client_OnMessage; _client.OnAuthError += _client_OnAuthError; _client.OnAuthenticate += _client_OnAuthenticate; _client.OnPresence += _client_OnPresence; _client.OnReadText += _client_OnReadText; _client.OnWriteText += _client_OnWriteText; _client.AutoLogin = true; _client.AutoPresence = true; _client.AutoReconnect = 1.0f; _client.AutoRoster = true; _client.AutoStartTLS = false; _client.AutoStartCompression = false; _client.KeepAlive = 30.0f; _conference = new jabber.connection.ConferenceManager(); _conference.Stream = _client; _presence = new jabber.client.PresenceManager(); _presence.Stream = _client; string[] x = Properties.Settings.Default.url_midlane.Split(':'); _client.Server = x[0]; _client.Port = 5222;// int.Parse( x[1] ); _client.User = "******"; _client.Password = "******"; _client.Connect(); Tooltip = "midlane: " + this.Uri; } catch (Exception er) { App.Log('!', "Midlane create error: {0}", er); fireOnFatalError(FatalErrorCodeEnum.ParsingError); return; } }
public void connect(string from, string pwd) { _myClient = new jabber.client.JabberClient(); _myClient.Server = "gmail.com"; _myClient.User = from; _myClient.Password = pwd; _myClient.Connect(); _myClient.OnConnect += new jabber.connection.StanzaStreamHandler(_myClient_OnConnect); _myClient.OnAuthError += new jabber.protocol.ProtocolHandler(_myClient_OnAuthError); }