}
protected static void handleCommand(int i, IRCMessage msg, IRCListener il) throws Exception {
Lang.ASSERT_NOT_NULL(il, "il");
Lang.ASSERT_NOT_NULL(msg, "msg");
IRCController queryClient = il.getProtocolHandler().getLocalClient();
Lang.ASSERT_NOT_NULL(queryClient, "queryClient");
//org.openmim.irc.mvc_impl.model.User_ clientFrom = msg.getUser();
//Lang.ASSERT_NOT_NULL(clientFrom, "clientFrom");
int middlePartsCount = msg.getMiddlePartsCount();
//
switch (i) {
default:
break;
//:goo!webchat@127.0.0.*** NOTICE goo :pidarrr
case RPL_EXT_ISON:
//":127.0.0.1 303 jj_mirc_foo :"
//":127.0.0.1 303 jj_mirc_foo :jj_mirc_foo "
//":127.0.0.1 303 jj_mirc_foo :jjj_mirc_foo jj_mirc_foo "
String[] nicksOnline = Acme.Utils.splitStr(msg.getTrailing().trim(), ' ');
Lang.ASSERT_NOT_NULL(nicksOnline, "nicksOnline");
il.handleIsonReply(/*server*/ msg.getPrefix(), nicksOnline);
return;
case RPL_EXT_NOTICE:
try {
il.handleNotice(msg.getPrefix(), msg.getSender(), msg.getTrailing());
}
catch (Exception ex) {
il.handleNotice(msg.getPrefix(), null, msg.getTrailing());
}
return;
case 002:
String s002 = msg.getTrailing();
// if (s002 != null && s002.toLowerCase().lastIndexOf(".ircz.") != -1)
// il.setIrczMuteSupported();
break;
// case 387 :
// :Beauce-R.Qc.UnderZ.Org 387 goo #goo :End of IRCChannel Mute List
// if (il.isIrczMuteSupported())
// {
// Lang.EXPECT(middlePartsCount >= 1, "middlePartsCount is expected to be >= 1, but it is " + middlePartsCount);
// String channelName = msg.getMiddlePart(1);
// Lang.EXPECT_NOT_NULL_NOR_TRIMMED_EMPTY(channelName, "channelName");
// il.handleMuteListEnd(channelName);
// return;
// }
// break;
// case 386 :
// //:Beauce-R.Qc.UnderZ.Org 386 goo #z jp!*@* sKaTeR 971112601
// // 1 2 3 4
// if (il.isIrczMuteSupported())
// {
// Lang.EXPECT(middlePartsCount >= 4, "middlePartsCount is expected to be >= 4, but it is " + middlePartsCount);
// String channelName = msg.getMiddlePart(1);
// String ircMaskMuted = msg.getMiddlePart(2);
// String muterNickName = msg.getMiddlePart(3);
// String timeAsString = msg.getMiddlePart(4);
// Lang.EXPECT_NOT_NULL_NOR_TRIMMED_EMPTY(channelName, "channelName");
// Lang.EXPECT_NOT_NULL_NOR_TRIMMED_EMPTY(ircMaskMuted, "ircMaskMuted");
// il.handleMuteListItem(new org.openmim.irc.driver.ircz.MuteListItem(channelName, ircMaskMuted, muterNickName, timeAsString));
// return;
// }
// break;
//:127.0.0.1 401 goo goojhg :No such nick/channel
case 401:
il.handleNoSuchNickChannel(msg.getMiddlePart(1), msg.getTrailing());
return;
//:127.0.0.1 301 goo goo :away message
case 301:
il.handleAwayMessage(msg.getMiddlePart(1), msg.getTrailing());
return;
case 405:
case 471:
case 473:
case 474:
case 475:
il.cannotJoinChannel(msg.getMiddlePart(1), msg.getTrailing());
return;
case 432:
case 433:
case 436:
il.invalidNickName(msg.getMiddlePart(1), msg.getTrailing());
return;
case 311:
il.handleWhoisUser(msg.getMiddlePart(1), msg.getMiddlePart(2), msg.getMiddlePart(3), msg.getTrailing());
return;
case 312:
il.handleWhoisServer(msg.getMiddlePart(1), msg.getMiddlePart(2), msg.getTrailing());
return;
case 313:
il.handleWhoisOperator(msg.getMiddlePart(1), msg.getTrailing());
return;
case 317:
il.handleWhoisIdleTime(msg.getMiddlePart(1), Integer.parseInt(msg.getMiddlePart(2)), msg.getTrailing());
return;
case 319:
il.handleWhoisChannelsOn(msg.getMiddlePart(1), msg.getTrailing());
return;
case 318:
il.handleWhoisEnd(msg.getMiddlePart(1), msg.getTrailing());
return;
case 331:
il.onInitialTopic(msg.getMiddlePart(1), false, msg.getTrailing());
return;
case 332:
il.onInitialTopic(msg.getMiddlePart(1), true, msg.getTrailing());
return;
case 367:
il.handleBanListItem(msg.getMiddlePart(1), msg.getMiddlePart(2));
return;
case 368:
il.handleBanListEnd(msg.getMiddlePart(1));
return;
case -101:
{
String to = msg.getMiddlePart(0);
Lang.ASSERT_NOT_NULL_NOR_EMPTY(to, "privmsg.to");
//char c = to.charAt(0);
//boolean isToChannel = (c == '#' || c == '&');
////
User userFrom = msg.getSender();
Lang.ASSERT_NOT_NULL(userFrom, "userFrom");
//if (!isToChannel)
//{
////new Query should not be created at all for ignored users.
//if (il.shouldCreateQuery(userFrom, msg.getTrailing()))
//queryClient.onJoinedQuery(userFrom);
//}
if (msg.getTrailing() != null) {
String s = msg.getTrailing();
if (s.startsWith("\001")) {
boolean flag1 = s.endsWith("\001") && s.length() > 1;
int j = flag1 ? s.length() - 1 : s.length();
handleCtcp(msg, s.substring(1, j), il);
return;
}
}
il.textMessageReceived(//
userFrom, //
to, //
msg.getTrailing());
return;
}
case -100:
il.ping(msg.getTrailing());
return;
case -103:
handleJoin(il, msg);
return;
case 353:
parseNamReply(il, msg);
return;
case RPL_EXT_PART:
{
String channelName = msg.getMiddlePart(0);
IRCUser userFrom = msg.getSender();
Lang.ASSERT_NOT_NULL(userFrom, "userFrom");
IRCChannelParticipant IRCChannelRole = queryClient.getChannelRoleByChannelName(userFrom, channelName);
Lang.EXPECT_NOT_NULL(IRCChannelRole, "IRCChannelRole");
IRCChannel channel = (IRCChannel) IRCChannelRole.getRoom();
channel.parts(IRCChannelRole, msg.getTrailing());
il.handlePart(channelName, userFrom, msg.getTrailing() != null ? msg.getTrailing() : userFrom.getActiveNick());
return;
}
case -106:
il.handleTopic(msg.getMiddlePart(0), msg.getTrailing());
return;
case -105:
{
IRCUser userFrom = msg.getSender();
Lang.ASSERT_NOT_NULL(userFrom, "userFrom");
queryClient.onQuit(userFrom);
il.quit(userFrom.getActiveNick(), msg.getTrailing());
return;
}
case -104:
{
IRCUser userFrom = msg.getSender();
Lang.ASSERT_NOT_NULL(userFrom, "userFrom");
String oldNickName = userFrom.getActiveNick();
String newNickName = msg.getTrailing();
if (newNickName == null) newNickName = msg.getMiddlePart(0);
il.nickChange(oldNickName, newNickName);
userFrom.setActiveNick(newNickName);
return;
}
case -108:
{
IRCUser userFrom = msg.getSender();
Lang.ASSERT_NOT_NULL(userFrom, "userFrom");
String channelName = msg.getMiddlePart(0);
String kickedNick = msg.getMiddlePart(1);
IRCChannel IRCChannel = queryClient.getChannelJoinedByChannelName(channelName);
Lang.EXPECT_NOT_NULL(IRCChannel, "IRCChannel named " + StringUtil.toPrintableString(channelName));
IRCChannelParticipant IRCChannelRole = queryClient.getChannelRoleByNickName(IRCChannel,kickedNick);
Lang.EXPECT_NOT_NULL(IRCChannelRole, "IRCChannelRole for " + StringUtil.toPrintableString(kickedNick) + " on " + StringUtil.toPrintableString(channelName));
IRCChannel.kicked(IRCChannelRole,userFrom,msg.getTrailing());
il.kick(userFrom.getActiveNick(), channelName, kickedNick, msg.getTrailing());
return;
}
case 1:
/* '\001' */
il.welcome(msg.getMiddlePart(0), msg.getTrailing());
queryClient.welcome_setNickName(msg.getMiddlePart(0));
return;
case RPL_EXT_MODE:
case 324:
//:127.0.0.1 324 goo #goo +
final boolean is324 = i == 324;