1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-22 17:02:21 -05:00

Handle auto joins after the user has registered with the server.

This commit is contained in:
liato 2011-03-08 03:07:07 +01:00 committed by Sebastian Kaspari
parent 84d45c5f5c
commit a3ebf8d5d0

View File

@ -155,7 +155,14 @@ public class IRCConnection extends PircBot
); );
service.sendBroadcast(intent); service.sendBroadcast(intent);
}
/**
* On register
*/
public void onRegister()
{
// execute commands // execute commands
CommandParser parser = CommandParser.getInstance(); CommandParser parser = CommandParser.getInstance();
@ -164,6 +171,10 @@ public class IRCConnection extends PircBot
parser.parse(command, server, server.getConversation(ServerInfo.DEFAULT_NAME), service); parser.parse(command, server, server.getConversation(ServerInfo.DEFAULT_NAME), service);
} }
// TODO: Detect "You are now identified for <nick>" notices from NickServ and handle
// auto joins in onNotice instead if the user has chosen to wait for NickServ
// identification before auto joining channels.
// delay 1 sec before auto joining channels // delay 1 sec before auto joining channels
try { try {
Thread.sleep(1000); Thread.sleep(1000);
@ -183,7 +194,6 @@ public class IRCConnection extends PircBot
} }
} }
} }
/** /**
* On channel action * On channel action
*/ */
@ -988,6 +998,11 @@ public class IRCConnection extends PircBot
@Override @Override
protected void onServerResponse(int code, String response) protected void onServerResponse(int code, String response)
{ {
if (code == 4) {
// User has registered with the server
onRegister();
return;
}
if (code == 372 || code == 375 || code == 376) { if (code == 372 || code == 375 || code == 376) {
// Skip MOTD // Skip MOTD
return; return;