break;
}
case BNCSCommandIDs.SID_ENTERCHAT: {
String uniqueUserName = is.readNTString();
myStatString = new StatString(is.readNTString());
/*String accountName =*/ is.readNTString();
myUser = BNetUser.getBNetUser(uniqueUserName, cs.myRealm);
recieveInfo("Logged in as " + myUser.getFullLogonName());
titleChanged();
// We are officially logged in!
// Get MOTD
BNCSPacket p = new BNCSPacket(BNCSCommandIDs.SID_NEWS_INFO);
p.writeDWord((int)(new java.util.Date().getTime() / 1000)); // timestamp
p.SendPacket(dos, cs.packetLog);
// Get friends list
p = new BNCSPacket(BNCSCommandIDs.SID_FRIENDSLIST);
p.SendPacket(dos, cs.packetLog);
// Join home channel
joinChannel(cs.channel);
break;
}
case BNCSCommandIDs.SID_NEWS_INFO: {
int numEntries = is.readByte();
//int lastLogon = is.readDWord();
//int oldestNews = is.readDWord();
//int newestNews = is.readDWord();;
is.skip(12);
for(int i = 0; i < numEntries; i++) {
int timeStamp = is.readDWord();
String news = is.readNTString().trim();
if(timeStamp == 0) // MOTD
recieveInfo(news);
}
break;
}
case BNCSCommandIDs.SID_CHATEVENT: {
int eid = is.readDWord();
int flags = is.readDWord();
int ping = is.readDWord();
is.skip(12);
// is.readDWord(); // IP Address (defunct)
// is.readDWord(); // Account number (defunct)
// is.readDWord(); // Registration authority (defunct)
String username = is.readNTString();
String text = is.readNTString();
BNetUser user = null;
switch(eid) {
case BNCSChatEventIDs.EID_SHOWUSER:
case BNCSChatEventIDs.EID_USERFLAGS:
case BNCSChatEventIDs.EID_JOIN:
case BNCSChatEventIDs.EID_LEAVE:
case BNCSChatEventIDs.EID_TALK:
case BNCSChatEventIDs.EID_EMOTE:
case BNCSChatEventIDs.EID_WHISPERSENT:
case BNCSChatEventIDs.EID_WHISPER:
switch(productID) {
case ProductIDs.PRODUCT_D2DV:
case ProductIDs.PRODUCT_D2XP:
int asterisk = username.indexOf('*');
if(asterisk >= 0)
username = username.substring(asterisk+1);
break;
}
user = BNetUser.getBNetUser(username, cs.myRealm);
user.setFlags(flags);
user.setPing(ping);
break;
}
switch(eid) {
case BNCSChatEventIDs.EID_SHOWUSER:
case BNCSChatEventIDs.EID_USERFLAGS:
channelUser(user, new StatString(text));
break;
case BNCSChatEventIDs.EID_JOIN:
channelJoin(user, new StatString(text));
break;
case BNCSChatEventIDs.EID_LEAVE:
channelLeave(user);
break;
case BNCSChatEventIDs.EID_TALK: