src/commands/Cmd_chat.cpp

00001 #include <string>
00002 #include "Cmd_chat.h"
00003 
00004 Cmd_chat::~Cmd_chat()
00005 {
00006     //dtor
00007 }
00008 
00009 void Cmd_chat::help(){
00010     std::cout << "Transforms the console in a basic chat application to send MSG_CHAT messages to attached clients" << std::endl;
00011 }
00012 
00013 void Cmd_chat::execute(){
00014     bool exit = false; // When to exit from the chat
00015     std::string msg;
00016 
00017     myServer->setChatMode();
00018     std::cout << "Chat mode activated. To exit please enter \"\\quit\" or \"\\q\"" << std::endl;
00019 
00020     while(!exit){
00021         std::getline(std::cin, msg);
00022         if(msg == "\\quit" || msg == "\\q")
00023             break;
00024         myServer->generalChatMsg(0, msg);
00025 
00026     }
00027 
00028     myServer->setChatMode(false);
00029     std::cout << "Quitting chat mode..." << std::endl;
00030 }
00031 
00032 

Generated on Mon Dec 3 04:30:12 2007 for lo-testserver by  doxygen 1.3.9.1