Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

explicit username in IRC backend #254

Closed
aadis opened this issue Jun 21, 2014 · 3 comments
Closed

explicit username in IRC backend #254

aadis opened this issue Jun 21, 2014 · 3 comments

Comments

@aadis
Copy link
Contributor

aadis commented Jun 21, 2014

I had another issue on trying to use the IRC backend for flowdock. In flowdock the nickname and the username are different. Here is my diff:

--- irc.py      2014-06-22 04:17:54.153544441 +0530
+++ /home/idbot/.virtualenvs/idbot27/lib/python2.7/site-packages/errbot/backends/irc.py 2014-04-19 14:01:08.425979216 +0530
 class IRCConnection(SingleServerIRCBot):
-    def __init__(self, callback, nickname, server, port=6667, ssl=False, password=None):
+    def __init__(self, callback, nickname, server, port=6667, ssl=False, password=None, username=None):
         self.use_ssl = ssl
         self.callback = callback
-        super().__init__([(server, port, password)], nickname, nickname)
+        super().__init__([(server, port, password)], nickname, username)

     def connect(self, *args, **kwargs):
         if self.use_ssl:
 class IRCBackend(ErrBot):
-    def __init__(self, nickname, server, port=6667, password=None, ssl=False):
+    def __init__(self, nickname, server, port=6667, password=None, ssl=False, username=None):
         super(IRCBackend, self).__init__()
-        self.conn = IRCConnection(self, nickname, server, port, ssl, password)
+        self.conn = IRCConnection(self, nickname, server, port, ssl, password, username)

This should be improved by setting username = nickname when username is None. If you want I can send in a pull request for this change.

@gbin
Copy link
Member

gbin commented Jun 21, 2014

Same thing, if you could open a proper pull request, it would be awesome. thx

@aadis
Copy link
Contributor Author

aadis commented Jun 22, 2014

Sent pull request (for both changes). I've tested the changes on my end, and they seem to work.

For the irc backend, the following config now works:

# The identity, or credentials, used to connect to a server
BOT_IDENTITY = {
    'nickname' : 'foobar',
    'username': 'foobar@example.com',
    'password' : 'foobar@example.com foobarpassword',
    'server' : 'irc.flowdock.com',
    'port': 6697, 
    'ssl': True,
}

(BTW, this config works for flowdock). Perhaps this can be documented somewhere?

@sijis
Copy link
Contributor

sijis commented Nov 20, 2014

Looks like this was fixed in PR #256

@gbin gbin closed this as completed Mar 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants