Changeset 159

Show
Ignore:
Timestamp:
05/21/05 12:08:54 (4 years ago)
Author:
jajcus
Message:

- basic password support (network configuration -- for single user setups only) by Robert B Quattlebaum, Jr.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/jjigw.dtd

    r138 r159  
    1616        jid             CDATA           #REQUIRED 
    1717        name            CDATA           #IMPLIED 
     18        password        CDATA           #IMPLIED 
    1819        encoding        CDATA           "us-ascii" 
    1920        nicks_8bit      (yes|no)        "no" 
  • trunk/jjigw/config.py

    r157 r159  
    8080        self.max_nick_length=int(node.prop("max_nick_length")) 
    8181        self.max_channel_length=int(node.prop("max_nick_length")) 
     82        self.password=node.prop("password") 
    8283    def get_servers(self): 
    8384        r=self.servers 
  • trunk/jjigw/ircsession.py

    r157 r159  
    5353        self.jid=jid 
    5454        self.nick=nick 
     55        # Insert some sort of password lookup here if required 
     56        self.password=self.network.password 
    5557        if self.component.profile: 
    5658            ttarget=self.thread_run_prof 
     
    287289            self.pass_message_to_raw_channel("Connected.") 
    288290        self.__logger.debug("Connected.") 
     291        if self.password: 
     292            self._send("PASS %s" % (self.password,)) 
    289293        self._send("NICK %s" % (self.nick,)) 
    290294        user=md5.new(self.jid.bare().as_string()).hexdigest()[:64] 
    291295        self.conninfo=ConnectionInfo(self.socket,user) 
    292296        self.component.register_connection(self.conninfo) 
    293         self._send("USER %s 0 * :JJIGW User %s" % (user,user)) 
     297        # If we had to issue a password, then chances are the server 
     298        # is going to be anal about what we pass for the USER. 
     299        # In this case, don't bother sending the hash. 
     300        if self.password: 
     301            self._send("USER %s 0 * :JJIGW User %s" % (self.nick, user) ) 
     302        else: 
     303            self._send("USER %s 0 * :JJIGW User %s" % (user,user)) 
    294304        self.server=server 
    295305        self.cond.notify() 
     
    357367 
    358368    def irc_cmd_PING(self,prefix,command,params): 
     369        # TODO: If this were implemented absolutely correctly, 
     370        # shouldn't this ping be sent to the client instead 
     371        # of immediately sending it back to the server? 
     372        # Otherwise, it will not give you an accurate reading 
     373        # of lag. 
    359374        self.send("PONG %s" % (params[0],)) 
    360375