Changeset 547

Show
Ignore:
Timestamp:
05/04/06 10:34:25 (3 years ago)
Author:
oxff
Message:

nepenthes-experimental: added ability to send command upon logon (e.g. NickServ? auth), limited to one JOIN per connect

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • nepenthes/branches/nepenthes-experimental/modules/log-irc/IrcDialogue.cpp

    r546 r547  
    7171        m_ConsumeLevel = CL_ASSIGN; 
    7272        m_LogIrc = logirc; 
     73        m_LoggedOn = false; 
    7374 
    7475        m_State = IRCDIA_REQUEST_SEND; 
     
    274275void IrcDialogue::loggedOn() 
    275276{ 
     277        if(m_LoggedOn) 
     278                return; 
     279                 
     280        try 
     281        { 
     282                string connectCommand = m_LogIrc->getConnectCommand(); 
     283                m_Socket->doRespond((char *) connectCommand.data(), connectCommand.size()); 
     284        } 
     285        catch(...) 
     286        { // no connect command was specified 
     287        } 
     288 
    276289        string joinCommand = "JOIN " + m_LogIrc->getIrcChannel() + " " + m_LogIrc->getIrcChannelPass() + "\r\n"; 
    277290        m_Socket->doRespond((char *) joinCommand.data(), joinCommand.size()); 
     291         
     292        m_LoggedOn = true; 
    278293} 
    279294 
  • nepenthes/branches/nepenthes-experimental/modules/log-irc/IrcDialogue.hpp

    r546 r547  
    8787                void processMessage(const char * origin, const char * target, const char * message); 
    8888                 
    89                 bool m_Pinged
     89                bool m_Pinged, m_LoggedOn
    9090                 
    9191                LogIrc  *m_LogIrc; 
  • nepenthes/branches/nepenthes-experimental/modules/log-irc/log-irc.conf.dist

    r546 r547  
    3030            pass    "foo"; 
    3131        }; 
     32         
     33        // has to be one IRC command NOT terminated with \r\n 
     34        // connect-command = "PRIVMSG NickServ :IDENTIFY mypassword"; 
    3235    }; 
    3336}; 
  • nepenthes/branches/nepenthes-experimental/modules/log-irc/log-irc.cpp

    r546 r547  
    347347} 
    348348 
     349string LogIrc::getConnectCommand() 
     350{ 
     351        string connectCommand = m_Config->getValString("log-irc.irc.connect-command"); 
     352         
     353        if(connectCommand.empty()) 
     354                throw (void *) 0; 
     355         
     356        return connectCommand + "\r\n"; 
     357} 
     358 
     359 
    349360void LogIrc::setDialogue(IrcDialogue *dia) 
    350361{ 
  • nepenthes/branches/nepenthes-experimental/modules/log-irc/log-irc.hpp

    r546 r547  
    8888                string getTorServer(); 
    8989                string getIrcServer(); 
     90                 
     91                //! throws exception if no command was specified 
     92                string getConnectCommand(); 
    9093 
    9194