From: Keith F. <ven...@us...> - 2002-03-27 07:09:52
|
Update of /cvsroot/planeshift/planeshift/src/server In directory usw-pr-cvs1:/tmp/cvs-serv15228 Modified Files: usermanager.h usermanager.cpp Log Message: Added /online command to see buddies currently online. Index: usermanager.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/usermanager.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** usermanager.h 10 Mar 2002 16:24:43 -0000 1.2 --- usermanager.h 27 Mar 2002 07:09:49 -0000 1.3 *************** *** 34,38 **** void Buddy(psUserCmdMessage& msg,Client *client,int clientnum); void NotBuddy(psUserCmdMessage& msg,Client *client,int clientnum); ! void BuddyList(psUserCmdMessage& msg,Client *client,int clientnum); MsgHandler* msghandler; --- 34,38 ---- void Buddy(psUserCmdMessage& msg,Client *client,int clientnum); void NotBuddy(psUserCmdMessage& msg,Client *client,int clientnum); ! void BuddyList(psUserCmdMessage& msg,Client *client,int clientnum,bool filter); MsgHandler* msghandler; Index: usermanager.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/usermanager.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** usermanager.cpp 19 Mar 2002 18:18:54 -0000 1.5 --- usermanager.cpp 27 Mar 2002 07:09:49 -0000 1.6 *************** *** 75,79 **** else if (msg.command == "/buddylist") { ! BuddyList(msg,client,me->clientnum); } else --- 75,83 ---- else if (msg.command == "/buddylist") { ! BuddyList(msg,client,me->clientnum,FALSE); ! } ! else if (msg.command == "/online") ! { ! BuddyList(msg,client,me->clientnum,TRUE); } else *************** *** 86,93 **** void UserManager::Who(psUserCmdMessage& msg,Client *client,int clientnum) { - // XXX: I can't see what the intention of this function is, but I'm - // quite sure the implementation was wrong :)¸ as it was cycling through - // a loop without using the pointer... - #if 0 BinaryTreeIterator<Client> *loop = clients->GetIterator(); --- 90,93 ---- *************** *** 105,116 **** for (curr = loop->First(); curr; curr = loop->Next()) { ! psSystemMessage newmsg(clientnum,"%s the DragonSlayer, Grand Master in the Heroic Few",client->GetPlayerName() ); msghandler->SendMessage(newmsg.msg); } - #endif - (void) msg; - (void) client; - (void) clientnum; - return; --- 105,111 ---- for (curr = loop->First(); curr; curr = loop->Next()) { ! psSystemMessage newmsg(clientnum,"%s the DragonSlayer, Grand Master in the Heroic Few",curr->GetPlayerName() ); msghandler->SendMessage(newmsg.msg); } return; *************** *** 198,202 **** } ! void UserManager::BuddyList(psUserCmdMessage& msg,Client *client,int clientnum) { (void) msg; --- 193,197 ---- } ! void UserManager::BuddyList(psUserCmdMessage& msg,Client *client,int clientnum,bool filter) { (void) msg; *************** *** 207,222 **** if (rs) { ! psSystemMessage newmsg(clientnum,"%s's Buddy List",(const char *)client->GetPlayerName()); ! msghandler->SendMessage(newmsg.msg); ! psSystemMessage newmsg2(clientnum,"-------------------------------------",(const char *)client->GetPlayerName()); msghandler->SendMessage(newmsg2.msg); for (unsigned int i=0; i<rs->Count(); i++) { ! psSystemMessage newmsg(clientnum,"%s",(*rs)[i][0] ); msghandler->SendMessage(newmsg.msg); } ! if (!rs->Count()) { psSystemMessage newmsg(clientnum,"(You have no buddies on your list right now.)" ); --- 202,234 ---- if (rs) { ! if (!filter) ! { ! psSystemMessage newmsg(clientnum,"%s's Buddy List",(const char *)client->GetPlayerName()); ! msghandler->SendMessage(newmsg.msg); ! } ! else ! { ! psSystemMessage newmsg(clientnum,"Currently Online"); ! msghandler->SendMessage(newmsg.msg); ! } ! psSystemMessage newmsg2(clientnum, ! "-------------------------------------", ! (const char *)client->GetPlayerName()); msghandler->SendMessage(newmsg2.msg); + int count=0; for (unsigned int i=0; i<rs->Count(); i++) { ! const char *who = (*rs)[i][0]; ! ! if (filter && !clients->Find(who)) // skip if doing online filter and not online ! continue; ! ! psSystemMessage newmsg(clientnum,"%s",who); msghandler->SendMessage(newmsg.msg); + count++; } ! if (!count) { psSystemMessage newmsg(clientnum,"(You have no buddies on your list right now.)" ); |