private void SetupHipChatClient() { if (_client != null) { return; } _client = new XmppClientConnection(_host); _client.AutoResolveConnectServer = false; _client.OnLogin += OnClientLogin; _client.OnMessage += OnClientMessage; _client.OnError += OnClientError; _client.OnAuthError += OnClientAuthError; _client.Resource = "bot"; _client.UseStartTLS = true; _api = new HipChatAPI(_authToken); _botUser = _api.ViewUser(_email); Logger.Info(string.Format("Connecting to {0}", _host)); _client.Open(_botUser.XmppJid.Split('@')[0], _password); Logger.Info(string.Format("Connected to {0}", _host)); _client.OnRosterStart += OnClientRosterStart; _client.OnRosterItem += OnClientRosterItem; }