[Twisted-Python] twisted words irc patch for usernames
![](https://secure.gravatar.com/avatar/91332725097dfef3805c62175857f0b5.jpg?s=120&d=mm&r=g)
Currently when twisted connects to an irc server, the username on the USER connect line, is assumed to be the same as the nickname. Below is a patch that lets the username be set manually the same way as 'password' is defined. If a username isn't specified, it defaults to assuming self.username = nickname I found this useful to connect to a server which required a specific username as part of its authentication but I didn't want to / need to run ident. I couldn't think of a good reason for not being able to set the username if we can already set everything else :-) Index: Twisted/twisted/words/protocols/irc.py =================================================================== --- Twisted/twisted/words/protocols/irc.py (revision 14959) +++ Twisted/twisted/words/protocols/irc.py (working copy) @@ -535,6 +535,7 @@ nickname = 'irc' password = None realname = None + username = None ### Responses to various CTCP queries. userinfo = None @@ -895,7 +896,9 @@ if self.password is not None: self.sendLine("PASS %s" % self.password) self.setNick(nickname) - self.sendLine("USER %s foo bar :%s" % (nickname, self.realname)) + if self.username is None: + self.username = nickname + self.sendLine("USER %s foo bar :%s" % (self.username, self.realname)) def setNick(self, nickname): self.nickname = nickname -- Avleen Vig Systems Administrator Personal: www.silverwraith.com "Wickedness is a myth invented by good people to account for the curious attractiveness of others." - Oscar Wilde
![](https://secure.gravatar.com/avatar/d7875f8cfd8ba9262bfff2bf6f6f9b35.jpg?s=120&d=mm&r=g)
On Sun, 2005-10-30 at 01:55 -0700, Avleen Vig wrote:
Currently when twisted connects to an irc server, the username on the USER connect line, is assumed to be the same as the nickname.
Hi, Could you add this to http://twistedmatrix.com/bugs/? Thanks!
![](https://secure.gravatar.com/avatar/d7875f8cfd8ba9262bfff2bf6f6f9b35.jpg?s=120&d=mm&r=g)
On Sun, 2005-10-30 at 01:55 -0700, Avleen Vig wrote:
Currently when twisted connects to an irc server, the username on the USER connect line, is assumed to be the same as the nickname.
Hi, Could you add this to http://twistedmatrix.com/bugs/? Thanks!
participants (2)
-
Avleen Vig
-
Itamar Shtull-Trauring