Merge lp:~stefanor/ibid/memo-source-634253 into lp:~ibid-core/ibid/old-trunk-1.6

Proposed by Stefano Rivera
Status: Merged
Approved by: Max Rabkin
Approved revision: 912
Merged at revision: 975
Proposed branch: lp:~stefanor/ibid/memo-source-634253
Merge into: lp:~ibid-core/ibid/old-trunk-1.6
Diff against target: 59 lines (+18/-8)
1 file modified
ibid/plugins/memo.py (+18/-8)
To merge this branch: bzr merge lp:~stefanor/ibid/memo-source-634253
Reviewer Review Type Date Requested Status
Jonathan Hitchcock Approve
marcog (community) Approve
Max Rabkin Approve
Review via email: mp+37855@code.launchpad.net

This proposal supersedes a proposal from 2010-10-02.

Commit message

Always respond to memo sending with confirmation of recipient. Allow memos to begin with "on ..." when not naming a known source.

To post a comment you must log in.
Revision history for this message
marcog (marco-gallotta) wrote : Posted in a previous version of this proposal

23 + response = (u"OK. I'll assume that you want me to tell "
24 + u"that to %s on %s." % (who, event.source))

In some obscure corner case of ambiguity, we're responding with an unusual reply. Isn't this going to be a little surprising? Perhaps change the default response to: Okay. I'll (tell|ask) <user> [on <source>].

Also, what happened to not liking tuples for the response? :P

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

Marco: r911

Revision history for this message
marcog (marco-gallotta) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Jonathan Hitchcock (vhata) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Max Rabkin (max-rabkin) wrote : Posted in a previous version of this proposal

<Taejo> tibid: tell Taejo on second thoughts, I'm not sure if this patch is right
<tibid> Taejo: Got it, I'll tell Taejo on atrum
<Taejo> lessee
<tibid> Taejo: By the way, Taejo on atrum told me "tell Taejo thoughts, I'm not sure if this patch is right" 6 seconds ago

review: Needs Fixing
Revision history for this message
Max Rabkin (max-rabkin) :
review: Approve
Revision history for this message
marcog (marco-gallotta) :
review: Approve
Revision history for this message
Jonathan Hitchcock (vhata) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ibid/plugins/memo.py'
2--- ibid/plugins/memo.py 2010-08-15 11:28:32 +0000
3+++ ibid/plugins/memo.py 2010-10-07 14:49:45 +0000
4@@ -3,6 +3,8 @@
5
6 from datetime import datetime
7 import logging
8+from random import choice
9+import re
10
11 import ibid
12 from ibid.plugins import Processor, handler, match, authorise
13@@ -71,14 +73,16 @@
14 permissions = (u'recvmemo',)
15
16 @match(r'^\s*(?:please\s+)?(tell|pm|privmsg|msg|ask)'
17- r'\s+(\S+)\s+(?:on\s+(\S+)\s+)?(.+?)\s*$', version='deaddressed')
18+ r'\s+(\S+)\s+(.+?)\s*$', version='deaddressed')
19 @authorise(fallthrough=False)
20- def tell(self, event, how, who, source, memo):
21- source_specified = bool(source)
22- if not source:
23+ def tell(self, event, how, who, memo):
24+ m = re.match(r'^on\s+(\S+?)\s+(.+)$', memo, re.I | re.U)
25+ source_specified = bool(m) and m.group(1).lower() in ibid.sources
26+ if source_specified:
27+ source = m.group(1).lower()
28+ memo = m.group(2)
29+ else:
30 source = event.source
31- else:
32- source = source.lower()
33
34 if source.lower() == event.source and \
35 any(True for name in ibid.config.plugins['core']['names']
36@@ -87,7 +91,7 @@
37 return
38
39 to = event.session.query(Identity) \
40- .filter_by(identity=who, source=source).first()
41+ .filter_by(identity=who, source=source).first()
42
43 if not to and not source_specified:
44 account = event.session.query(Account) \
45@@ -139,7 +143,13 @@
46 nomemos_cache.clear()
47 notified_overlimit_cache.discard(to.id)
48
49- event.addresponse(True)
50+ event.addresponse(u"%(acknowledgement)s, I'll %(action)s "
51+ u"%(recipient)s on %(source)s", {
52+ 'acknowledgement': choice(('Okay', 'Righto', 'Sure', 'Got it')),
53+ 'action': how.lower(),
54+ 'recipient': to.identity,
55+ 'source': to.source,
56+ })
57
58 @match(r'^(?:delete|forget)\s+(?:my\s+)?'
59 r'(?:(first|last|\d+(?:st|nd|rd|th)?)\s+)?' # 1st way to specify number

Subscribers

People subscribed via source and target branches