123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #ifndef __CHATCOMMAND_H
- #define __CHATCOMMAND_H
- #include "message.h"
- #include "chatclient.h"
- #include "datastring.h"
- #include "user.h"
- #include "simplechatgameuser.h"
- // This is the base class for all chat commands.
- class chatcommand
- {
- public:
- //virtual bool processmessage(message *chatmessage,chatclient *client) = 0; // Returns true if the message was processed.
- static void incorrect_system_password(chatclient *client,int64_t messageid);
- static void not_implemented(chatclient *client);
- static void parameters_not_correct(chatclient *client,message *received_message);
- static void message_not_understood(chatclient *client,datastring bad_message);
- static void success_message(chatclient *client,int64_t messageid);
- static void error(chatclient *client,datastring error_message,int64_t messageid);
- static void error(chatclient *client,datastring error_message);
- // These methods create messages that the client will understand.
- // They don't actually send the message. The calling method does that.
- static message *userjoinedchatroom(int64_t messageid,int64_t chatroomid,int64_t chatclientid, user *new_user);
- static message *userleftchatroom(int64_t messageid,int64_t chatroomid,int64_t chatclientid,user *old_user);
- static message *chatroomwasdeleted(int64_t messageid,int64_t chatroomid);
- static message *chatroomcreated(int64_t messageid,int64_t chatroomid,datastring room_name,int info);
- static message *yourchatclientid(int64_t chatclientid);
- static message *chat(int64_t messageid,int64_t chatroomid,int64_t chatclientid,int64_t userid,datastring message_to_send);
- static message *msg(int64_t messageid,int64_t chatclientid,int64_t userid,datastring message_to_send);
- static message *simplegamestarted(int64_t messageid,datastring gameid);
- static message *simplegamedata(int64_t messageid,datastring gameid,datastring username,datastring gamedata);
- static message *simplegameleave(int64_t messageid,datastring gameid,datastring username,datastring gamedata);
- static message *simplegamechat(int64_t messageid,datastring gameid,datastring username,datastring chatmessage);
- static message *simplegamejoined(int64_t messageid,datastring gameid,datastring gamedata,biglist<simplechatgameuser *> *userlist);
- static message *simplegameusers(int64_t messageid,datastring gameid,biglist<simplechatgameuser *> *userlist);
- static message *simplegameuserdata(int64_t messageid,datastring gameid,datastring username,datastring userdata);
- private:
- static message *fromstringbuilder(stringbuilder &output);
- };
- #endif
|