Merge lp:~stefanor/ibid/nickserv-340728 into lp:~ibid-core/ibid/old-trunk-pack-0.92

Proposed by Stefano Rivera
Status: Merged
Approved by: Stefano Rivera
Approved revision: 698
Merged at revision: 693
Proposed branch: lp:~stefanor/ibid/nickserv-340728
Merge into: lp:~ibid-core/ibid/old-trunk-pack-0.92
Diff against target: None lines
To merge this branch: bzr merge lp:~stefanor/ibid/nickserv-340728
Reviewer Review Type Date Requested Status
Michael Gorven Approve
Jonathan Hitchcock Approve
Review via email: mp+8318@code.launchpad.net

This proposal supersedes a proposal from 2009-07-06.

To post a comment you must log in.
Revision history for this message
Stefano Rivera (stefanor) wrote : Posted in a previous version of this proposal

Thoughts?

Revision history for this message
Stefano Rivera (stefanor) wrote : Posted in a previous version of this proposal

> Thoughts?

My thoughts:
* This should be included in the default config. Commented out?
* I'm not mad about nickserv_connection.

Revision history for this message
Jonathan Hitchcock (vhata) wrote : Posted in a previous version of this proposal

> Thoughts?

I'm not keen on the hardcoding of "NickServ" either - that should be configurable...

Revision history for this message
Jonathan Hitchcock (vhata) wrote :

Do it.

If other nickserv types crop up, people can file bugs and we'll refine the plugin.

review: Approve
Revision history for this message
Michael Gorven (mgorven) wrote :

 review approve

review: Approve
lp:~stefanor/ibid/nickserv-340728 updated
699. By Stefano Rivera

Ensure IRC source

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ibid.ini'
--- ibid.ini 2009-05-31 08:10:44 +0000
+++ ibid.ini 2009-07-07 15:35:05 +0000
@@ -12,9 +12,13 @@
12 type = irc12 type = irc
13 server = za.atrum.org13 server = za.atrum.org
14 modes = B14 modes = B
15# nickserv_password = password
16 nickserv_mask = services@atrum.org
15 [[freenode]]17 [[freenode]]
16 type = irc18 type = irc
17 server = chat.eu.freenode.net19 server = chat.eu.freenode.net
20# nickserv_password = password
21 nickserv_mask = NickServ@services.
18 disabled = True22 disabled = True
19 [[jabber]]23 [[jabber]]
20 ssl = True24 ssl = True
@@ -55,7 +59,7 @@
55 object_path = /org/ibid/module/Ping59 object_path = /org/ibid/module/Ping
56 [[core]]60 [[core]]
57 names = $botname, bot, ant61 names = $botname, bot, ant
58 ignore = NickServ,62 ignore = ,
59 [[bzr]]63 [[bzr]]
60 source = atrum64 source = atrum
61 channel = "#ibid"65 channel = "#ibid"
@@ -77,3 +81,5 @@
7781
78[databases]82[databases]
79 ibid = sqlite:///ibid.db83 ibid = sqlite:///ibid.db
84
85# vi: set et sta sw=4 ts=4:
8086
=== modified file 'ibid/config.ini'
--- ibid/config.ini 2009-04-17 23:49:41 +0000
+++ ibid/config.ini 2009-07-06 14:13:24 +0000
@@ -17,7 +17,7 @@
17 cachedir = /tmp/ibid17 cachedir = /tmp/ibid
18 [[core]]18 [[core]]
19 names = $botname, bot, ant19 names = $botname, bot, ant
20 ignore = NickServ,20 ignore = ,
2121
22[databases]22[databases]
23 ibid = sqlite:///ibid.db23 ibid = sqlite:///ibid.db
2424
=== modified file 'ibid/plugins/irc.py'
--- ibid/plugins/irc.py 2009-03-16 20:55:20 +0000
+++ ibid/plugins/irc.py 2009-07-07 15:45:24 +0000
@@ -1,7 +1,12 @@
1"""Administrative commands for IRC"""1"""Administrative commands for IRC"""
22
3from fnmatch import fnmatch
4import logging
5
3import ibid6import ibid
4from ibid.plugins import Processor, match, authorise7from ibid.plugins import Processor, match, handler, authorise
8
9log = logging.getLogger('plugins.irc')
510
6help = {"irc": u"Provides commands for joining/parting channels on IRC and Jabber, and changing the bot's nick"}11help = {"irc": u"Provides commands for joining/parting channels on IRC and Jabber, and changing the bot's nick"}
712
@@ -60,4 +65,30 @@
60 source.change_nick(nick)65 source.change_nick(nick)
61 event.addresponse(u'Changing nick to %s', nick)66 event.addresponse(u'Changing nick to %s', nick)
6267
68class NickServ(Processor):
69 event_types = ('notice',)
70
71 def is_nickserv(self, event):
72 source_cfg = ibid.config['sources'][event.source]
73 return (event.sender.get('nick') ==
74 source_cfg.get(u'nickserv_nick', u'NickServ') and
75 fnmatch(event.sender['connection'].split('!', 1)[1],
76 source_cfg.get(u'nickserv_mask', '*')
77 ))
78
79 @match(r'^(?:This nickname is registered\. Please choose a different nickname'
80 r'|This nickname is registered and protected\. If it is your'
81 r'|If this is your nickname, type \/msg NS)')
82 def auth(self, event):
83 if self.is_nickserv(event):
84 source_cfg = ibid.config['sources'][event.source]
85 if u'nickserv_password' in source_cfg:
86 event.addresponse(u'IDENTIFY %s', source_cfg[u'nickserv_password'])
87
88 @match(r'^(?:You are now identified for'
89 r'|Password accepted -+ you are now recognized)')
90 def success(self, event):
91 if self.is_nickserv(event):
92 log.info(u'Authenticated with NickServ')
93
63# vi: set et sta sw=4 ts=4:94# vi: set et sta sw=4 ts=4:
6495
=== modified file 'ibid/plugins/log.py'
--- ibid/plugins/log.py 2009-07-04 23:45:41 +0000
+++ ibid/plugins/log.py 2009-07-06 14:16:40 +0000
@@ -20,6 +20,8 @@
20 u'%(year)d/%(month)02d/%(day)02d %(hour)02d:%(minute)02d:%(second)02d <%(sender_nick)s> %(message)s')20 u'%(year)d/%(month)02d/%(day)02d %(hour)02d:%(minute)02d:%(second)02d <%(sender_nick)s> %(message)s')
21 action_format = Option('action_format', 'Format string for actions',21 action_format = Option('action_format', 'Format string for actions',
22 u'%(year)d/%(month)02d/%(day)02d %(hour)02d:%(minute)02d:%(second)02d * %(sender_nick)s %(message)s')22 u'%(year)d/%(month)02d/%(day)02d %(hour)02d:%(minute)02d:%(second)02d * %(sender_nick)s %(message)s')
23 notice_format = Option('notice_format', 'Format string for notices',
24 u'%(year)d/%(month)02d/%(day)02d %(hour)02d:%(minute)02d:%(second)02d -%(sender_nick)s- %(message)s')
23 presence_format = Option('presence_format', 'Format string for presence events',25 presence_format = Option('presence_format', 'Format string for presence events',
24 u'%(year)d/%(month)02d/%(day)02d %(hour)02d:%(minute)02d:%(second)02d %(sender_nick)s (%(sender_connection)s) is now %(state)s')26 u'%(year)d/%(month)02d/%(day)02d %(hour)02d:%(minute)02d:%(second)02d %(sender_nick)s (%(sender_connection)s) is now %(state)s')
25 logs = {}27 logs = {}
@@ -50,13 +52,14 @@
50 return self.logs[filename][0]52 return self.logs[filename][0]
5153
52 def log_event(self, event):54 def log_event(self, event):
53 if event.type in ('message', 'state', 'action'):55 if event.type in ('message', 'state', 'action', 'notice'):
54 when = localtime(event.time)56 when = localtime(event.time)
5557
56 format = {58 format = {
57 'message': self.message_format,59 'message': self.message_format,
58 'state': self.presence_format,60 'state': self.presence_format,
59 'action': self.action_format,61 'action': self.action_format,
62 'notice': self.notice_format,
60 }[event.type]63 }[event.type]
6164
62 fields = {65 fields = {

Subscribers

People subscribed via source and target branches