use of f00f.net.irc.martyr.IRCConnection in project Openfire by igniterealtime.
the class IRCSession method logIn.
@Override
public void logIn(PresenceType presenceType, String verboseStatus) {
connection = new IRCConnection();
autoResponder = new AutoResponder(connection);
// autoReconnect = new AutoReconnect(connection);
autoRegister = new AutoRegister(connection, getRegistration().getNickname(), getRegistration().getNickname(), "IM Gateway User", getRegistration().getPassword());
listener = new IRCListener(this);
listener.enable();
new Thread() {
@Override
public void run() {
try {
connection.connect(JiveGlobals.getProperty("plugin.gateway.irc.connecthost", "irc.freenode.net"), JiveGlobals.getIntProperty("plugin.gateway.irc.connectport", 7000));
setPresence(PresenceType.available);
setLoginStatus(TransportLoginStatus.LOGGED_IN);
try {
getTransport().syncLegacyRoster(getJID(), getBuddyManager().getBuddies());
} catch (UserNotFoundException e) {
Log.debug("IRC: Error finding user while syncing legacy roster.");
}
List<String> buddyList = new ArrayList<String>();
for (TransportBuddy buddy : getBuddyManager().getBuddies()) {
buddyList.add(buddy.getName());
}
if (!buddyList.isEmpty()) {
connection.sendCommand(new IsonCommand(StringUtils.join(buddyList, " ")));
}
statusCheck = new StatusCheck();
timer.schedule(statusCheck, timerInterval, timerInterval);
getBuddyManager().activate();
} catch (UnknownHostException e) {
Log.debug("IRC: Unable to connect to host:", e);
setFailureStatus(ConnectionFailureReason.CAN_NOT_CONNECT);
sessionDisconnected("IRC server does not appear to exist.");
} catch (IOException e) {
Log.debug("IRC: Connection error while trying to connect ot IRC server:", e);
setFailureStatus(ConnectionFailureReason.CAN_NOT_CONNECT);
sessionDisconnected("Connection failed while trying to contact IRC server..");
}
}
}.start();
}
Aggregations