void ChannelPage::nickChange(const IrcClient::User &user, const QString &newNick) { print(QString("*** %1 is now known as %2") .arg(user.nick) .arg(newNick) , Information ); renameUser(user.nick, newNick); }
void IRCSession::processCommandNick(shared_ptr<IRCCommandNick> command) { OS_ASSERT(command != nullptr); if(renameUser(command->getOldNick(), command->getNewNick()) == false) { OS_ASSERTFALSE(); return; } updateAllRooms(true); }
// The network commandMessage method void commandMessage(std::string text, IClientSocket *socket) { std::string command, option, data; decodeMessage(text,command,option,data); fusion->errlog << "command = " << command << ", option = " << option << ", data = " << data << std::endl; // If all strings are empty, error occured, a blank // string, or messed up string cannot be processed if(command.empty() == true && option.empty() == true && data.empty() == true) return; if(socket == state.client) clientMessage(command,option,data,socket); else serverMessage(command,option,data,socket); /* Client/Server commands go here, where they are not resolved in the specific clientMessage/serverMessage methods */ // Client/Server command: both can change their userName they are chatting with if(command == "setUsername") { if(option.empty() == true){ // No ID passed with this command // WAITING CLIENT if(state.enableClient == true && getConnected() == "Connect"){ remoteMessage("/newClient,"+data); }else{ std::string name; std::string idcode = state.id; if(state.enableClient == true){ if(getConnected() == "Disconnect") name = state.username; else socket = state.client; }else if(state.enableServer == true){ if(socket == NULL) name = state.username; else idcode = idstring(socket); } clientMessage("/info,socket = "+idcode); remoteMessage("/setUsername,"+name+";"+data+":"+idcode,socket); } }else{ // ID was passed with this command size_t pos = option.find(";"); if(pos > 0){ std::string oldUser = option.substr(0,pos); std::string newUser = option.substr(pos+1); if(renameUser(oldUser,newUser,data) == true){ broadcastMessage("/setUsername,"+option+":"+data, socket); }else{ clientMessage("/error,userFound"); } }else{ updateUsername(option.substr(1)); } } } if(command == "quit") closeApp(); }