chatcommand.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef __CHATCOMMAND_H
  2. #define __CHATCOMMAND_H
  3. #include "message.h"
  4. #include "chatclient.h"
  5. #include "datastring.h"
  6. #include "user.h"
  7. #include "simplechatgameuser.h"
  8. // This is the base class for all chat commands.
  9. class chatcommand
  10. {
  11. public:
  12. //virtual bool processmessage(message *chatmessage,chatclient *client) = 0; // Returns true if the message was processed.
  13. static void incorrect_system_password(chatclient *client,int64_t messageid);
  14. static void not_implemented(chatclient *client);
  15. static void parameters_not_correct(chatclient *client,message *received_message);
  16. static void message_not_understood(chatclient *client,datastring bad_message);
  17. static void success_message(chatclient *client,int64_t messageid);
  18. static void error(chatclient *client,datastring error_message,int64_t messageid);
  19. static void error(chatclient *client,datastring error_message);
  20. // These methods create messages that the client will understand.
  21. // They don't actually send the message. The calling method does that.
  22. static message *userjoinedchatroom(int64_t messageid,int64_t chatroomid,int64_t chatclientid, user *new_user);
  23. static message *userleftchatroom(int64_t messageid,int64_t chatroomid,int64_t chatclientid,user *old_user);
  24. static message *chatroomwasdeleted(int64_t messageid,int64_t chatroomid);
  25. static message *chatroomcreated(int64_t messageid,int64_t chatroomid,datastring room_name,int info);
  26. static message *yourchatclientid(int64_t chatclientid);
  27. static message *chat(int64_t messageid,int64_t chatroomid,int64_t chatclientid,int64_t userid,datastring message_to_send);
  28. static message *msg(int64_t messageid,int64_t chatclientid,int64_t userid,datastring message_to_send);
  29. static message *simplegamestarted(int64_t messageid,datastring gameid);
  30. static message *simplegamedata(int64_t messageid,datastring gameid,datastring username,datastring gamedata);
  31. static message *simplegameleave(int64_t messageid,datastring gameid,datastring username,datastring gamedata);
  32. static message *simplegamechat(int64_t messageid,datastring gameid,datastring username,datastring chatmessage);
  33. static message *simplegamejoined(int64_t messageid,datastring gameid,datastring gamedata,biglist<simplechatgameuser *> *userlist);
  34. static message *simplegameusers(int64_t messageid,datastring gameid,biglist<simplechatgameuser *> *userlist);
  35. static message *simplegameuserdata(int64_t messageid,datastring gameid,datastring username,datastring userdata);
  36. private:
  37. static message *fromstringbuilder(stringbuilder &output);
  38. };
  39. #endif