void connect(VPServices app) { lock (mutex) { app.NotifyAll(msgConnecting, app.World, config.Channel, config.Host); Log.Info(Name, "Creating and establishing IRC bridge..."); try { irc.Connect(config.Host, config.Port); irc.Login(config.NickName, config.RealName); Log.Debug(Name, "Connected and logged into {0}", config.Host); } catch (Exception e) { // Ensure disconnection if (irc.IsConnected) { irc.Disconnect(); } app.WarnAll(msgConnectError, e.Message); Log.Warn(Name, "Could not login to IRC: {0}", e.Message); return; } try { irc.RfcJoin(config.Channel); Log.Debug(Name, "Joined channel {0}", config.Channel); } catch (Exception e) { // Ensure disconnection if (irc.IsConnected) { irc.Disconnect(); } app.WarnAll(msgConnectError, e.Message); Log.Warn(Name, "Could not join channel: {0}", e.Message); return; } // Start IRC task Task.Factory.StartNew(updateLoop); } }
void connect(VPServices app) { lock (mutex) { app.NotifyAll(msgConnecting, app.World, config.Channel, config.Host); Log.Info(Name, "Creating and establishing IRC bridge..."); try { irc.Connect(config.Host, config.Port); irc.Login(config.NickName, config.RealName); Log.Debug(Name, "Connected and logged into {0}", config.Host); } catch (Exception e) { // Ensure disconnection if (irc.IsConnected) irc.Disconnect(); app.WarnAll(msgConnectError, e.Message); Log.Warn(Name, "Could not login to IRC: {0}", e.Message); return; } try { irc.RfcJoin(config.Channel); Log.Debug(Name, "Joined channel {0}", config.Channel); } catch (Exception e) { // Ensure disconnection if (irc.IsConnected) irc.Disconnect(); app.WarnAll(msgConnectError, e.Message); Log.Warn(Name, "Could not join channel: {0}", e.Message); return; } // Start IRC task Task.Factory.StartNew(updateLoop); } }