the bot now understands renaming, and answer to "plop ?"
This commit is contained in:
		
							parent
							
								
									b86a0c1845
								
							
						
					
					
						commit
						98c8a64d6a
					
				@ -46,16 +46,16 @@ void SparrowBot::forceStatus(int newStatus)
 | 
			
		||||
 | 
			
		||||
void SparrowBot::handleMessage(Message msg)
 | 
			
		||||
{
 | 
			
		||||
    // si la ligne est un message
 | 
			
		||||
    if(msg.command.compare(QString("PRIVMSG"), Qt::CaseInsensitive) == 0)
 | 
			
		||||
    {
 | 
			
		||||
        // message
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        // mise à jour du bot
 | 
			
		||||
        if(msg.args.compare("!update") == 0 && msg.src != NULL && msg.src->isOp())
 | 
			
		||||
        {
 | 
			
		||||
            sendRawMessage("QUIT :i'll be back\r\n");
 | 
			
		||||
            exit(0);
 | 
			
		||||
        }
 | 
			
		||||
        // affiche les gens connectés
 | 
			
		||||
        if(msg.args.compare("!list") == 0)
 | 
			
		||||
        {
 | 
			
		||||
            string str = "Online users : ";
 | 
			
		||||
@ -68,9 +68,17 @@ void SparrowBot::handleMessage(Message msg)
 | 
			
		||||
                    str += u->getNick().toStdString() + " ";
 | 
			
		||||
            say(str);
 | 
			
		||||
        }
 | 
			
		||||
        if(msg.args.compare("plop ?") == 0)
 | 
			
		||||
            action("est content");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if(msg.command.compare(QString("353"), Qt::CaseInsensitive) == 0)
 | 
			
		||||
    // renommage
 | 
			
		||||
    else if(msg.command.compare(QString("NICK"), Qt::CaseInsensitive) == 0)
 | 
			
		||||
        msg.src->rename(msg.args);
 | 
			
		||||
 | 
			
		||||
    // 353 = code de la ligne qui liste les nicks connectés
 | 
			
		||||
    // on les parse et on effectue un WHOIS sur chaque nick
 | 
			
		||||
    else if(msg.command.compare(QString("353"), Qt::CaseInsensitive) == 0)
 | 
			
		||||
    {
 | 
			
		||||
        // names
 | 
			
		||||
        QStringList names = msg.args.split(' ');
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										5
									
								
								user.cpp
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								user.cpp
									
									
									
									
									
								
							@ -8,6 +8,11 @@ User::User(QString str)
 | 
			
		||||
    nick = str;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void User::rename(QString newNick)
 | 
			
		||||
{
 | 
			
		||||
    nick = newNick;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString User::getNick()
 | 
			
		||||
{
 | 
			
		||||
    return nick;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user