Skip to content

Commit 600c289

Browse files
author
Richard Jones
committed
Features:
. [SF#467129] Lossage when username=e-mail-address . [SF#473123] Change message generation for author . MailGW now moves 'resolved' to 'chatting' on receiving e-mail for an issue.
1 parent ac7d3a6 commit 600c289

File tree

10 files changed

+125
-27
lines changed

10 files changed

+125
-27
lines changed

CHANGES.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ This file contains the changes to the Roundup system over time. The entries
22
are given with the most recent entry first.
33

44
2001-10-?? - 0.3.0
5+
Feature:
6+
. #467129 ] Lossage when username=e-mail-address
7+
. #473123 ] Change message generation for author
8+
. MailGW now moves 'resolved' to 'chatting' on receiving e-mail for an issue.
9+
510
Fixed:
611
. Fixed a bug in HTMLTemplate changes.
712
. 'unread' to 'chatting' automagic status change was b0rken.

MIGRATION.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,7 @@ FILTER_POSITION, ANONYMOUS_ACCESS, ANONYMOUS_REGISTER have been added to
7777
the instance_config.py. Simplest solution is to copy the default values from
7878
template in the core source.
7979

80+
MESSAGES_TO_AUTHOR has been added to the IssueClass in dbinit.py. Set to 'yes'
81+
to send nosy messages to the author. Default behaviour is to not send nosy
82+
messages to the author.
83+

roundup/mailgw.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class node. Any parts of other types are each stored in separate files
7272
an exception, the original message is bounced back to the sender with the
7373
explanatory message given in the exception.
7474
75-
$Id: mailgw.py,v 1.25 2001-10-28 23:22:28 richard Exp $
75+
$Id: mailgw.py,v 1.26 2001-10-30 00:54:45 richard Exp $
7676
'''
7777

7878

@@ -365,17 +365,20 @@ def handle_message(self, message):
365365
messages.append(message_id)
366366
props['messages'] = messages
367367

368-
# if the message is currently 'unread', then set it to 'chatting'
368+
# if the message is currently 'unread' or 'resolved', then set
369+
# it to 'chatting'
369370
if properties.has_key('status'):
370371
try:
371-
# determine the id of 'unread' and 'chatting'
372+
# determine the id of 'unread', 'resolved' and 'chatting'
372373
unread_id = self.db.status.lookup('unread')
374+
resolved_id = self.db.status.lookup('resolved')
373375
chatting_id = self.db.status.lookup('chatting')
374376
except KeyError:
375377
pass
376378
else:
377379
if (not props.has_key('status') or
378-
props['status'] == unread_id):
380+
props['status'] == unread_id or
381+
props['status'] == resolved_id):
379382
props['status'] = chatting_id
380383

381384
cl.set(nodeid, **props)
@@ -441,6 +444,9 @@ def parseContent(content, blank_line=re.compile(r'[\r\n]+\s*[\r\n]+'),
441444

442445
#
443446
# $Log: not supported by cvs2svn $
447+
# Revision 1.25 2001/10/28 23:22:28 richard
448+
# fixed bug #474749 ] Indentations lost
449+
#
444450
# Revision 1.24 2001/10/23 22:57:52 richard
445451
# Fix unread->chatting auto transition, thanks Roch'e
446452
#

roundup/roundupdb.py

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: roundupdb.py,v 1.15 2001-10-23 01:00:18 richard Exp $
18+
# $Id: roundupdb.py,v 1.16 2001-10-30 00:54:45 richard Exp $
1919

2020
import re, os, smtplib, socket
2121

@@ -44,7 +44,23 @@ def uidFromAddress(self, address, create=1):
4444
'''
4545
(realname, address) = address
4646
users = self.user.stringFind(address=address)
47-
if users: return users[0]
47+
for dummy in range(2):
48+
if len(users) > 1:
49+
# make sure we don't match the anonymous or admin user
50+
for user in users:
51+
if user == '1': continue
52+
if self.user.get(user, 'username') == 'anonymous': continue
53+
# first valid match will do
54+
return user
55+
# well, I guess we have no choice
56+
return user[0]
57+
elif users:
58+
return users[0]
59+
# try to match the username to the address (for local
60+
# submissions where the address is empty)
61+
users = self.user.stringFind(username=address)
62+
63+
# couldn't match address or username, so create a new user
4864
return self.user.create(username=address, address=address,
4965
realname=realname)
5066

@@ -200,6 +216,9 @@ def getprops(self, protected=1):
200216

201217
# XXX deviation from spec - was called ItemClass
202218
class IssueClass(Class):
219+
# configuration
220+
MESSAGES_TO_AUTHOR = 'no'
221+
203222
# Overridden methods:
204223

205224
def __init__(self, db, classname, **properties):
@@ -247,13 +266,25 @@ def sendmessage(self, nodeid, msgid):
247266
r = {}
248267
for recipid in recipients:
249268
r[recipid] = 1
269+
270+
# figure the author's id, and indicate they've received the message
250271
authid = self.db.msg.get(msgid, 'author')
251272
r[authid] = 1
252273

253-
# now figure the nosy people who weren't recipients
254274
sendto = []
275+
# ... but duplicate the message to the author as long as it's not
276+
# the anonymous user
277+
if (self.MESSAGES_TO_AUTHOR == 'yes' and
278+
self.db.user.get(authid, 'username') != 'anonymous'):
279+
sendto.append(authid)
280+
281+
# now figure the nosy people who weren't recipients
255282
nosy = self.get(nodeid, 'nosy')
256283
for nosyid in nosy:
284+
# Don't send nosy mail to the anonymous user (that user
285+
# shouldn't appear in the nosy list, but just in case they
286+
# do...)
287+
if self.db.user.get(nosyid, 'username') == 'anonymous': continue
257288
if not r.has_key(nosyid):
258289
sendto.append(nosyid)
259290
recipients.append(nosyid)
@@ -278,6 +309,7 @@ def sendmessage(self, nodeid, msgid):
278309
# TODO attachments
279310
m = ['Subject: [%s%s] %s'%(cn, nodeid, title)]
280311
m.append('To: %s'%', '.join(sendto))
312+
m.append('From: %s'%self.ISSUE_TRACKER_EMAIL)
281313
m.append('Reply-To: %s'%self.ISSUE_TRACKER_EMAIL)
282314
m.append('')
283315
# add author information
@@ -307,6 +339,13 @@ def email_footer(self, nodeid, msgid):
307339

308340
#
309341
# $Log: not supported by cvs2svn $
342+
# Revision 1.15 2001/10/23 01:00:18 richard
343+
# Re-enabled login and registration access after lopping them off via
344+
# disabling access for anonymous users.
345+
# Major re-org of the htmltemplate code, cleaning it up significantly. Fixed
346+
# a couple of bugs while I was there. Probably introduced a couple, but
347+
# things seem to work OK at the moment.
348+
#
310349
# Revision 1.14 2001/10/21 07:26:35 richard
311350
# feature #473127: Filenames. I modified the file.index and htmltemplate
312351
# source so that the filename is used in the link and the creation

roundup/templates/classic/dbinit.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: dbinit.py,v 1.8 2001-10-09 07:25:59 richard Exp $
18+
# $Id: dbinit.py,v 1.9 2001-10-30 00:54:45 richard Exp $
1919

2020
import os
2121

@@ -39,6 +39,7 @@ class IssueClass(roundupdb.IssueClass):
3939
ISSUE_TRACKER_EMAIL = instance_config.ISSUE_TRACKER_EMAIL
4040
ADMIN_EMAIL = instance_config.ADMIN_EMAIL
4141
MAILHOST = instance_config.MAILHOST
42+
MESSAGES_TO_AUTHOR = instance_config.MESSAGES_TO_AUTHOR
4243

4344

4445
def open(name=None):
@@ -125,6 +126,10 @@ def init(adminpw):
125126

126127
#
127128
# $Log: not supported by cvs2svn $
129+
# Revision 1.8 2001/10/09 07:25:59 richard
130+
# Added the Password property type. See "pydoc roundup.password" for
131+
# implementation details. Have updated some of the documentation too.
132+
#
128133
# Revision 1.7 2001/08/07 00:24:43 richard
129134
# stupid typo
130135
#

roundup/templates/classic/detectors/nosyreaction.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: nosyreaction.py,v 1.3 2001-08-07 00:24:43 richard Exp $
18+
#$Id: nosyreaction.py,v 1.4 2001-10-30 00:54:45 richard Exp $
1919

2020
def nosyreaction(db, cl, nodeid, oldvalues):
2121
''' A standard detector is provided that watches for additions to the
@@ -58,16 +58,20 @@ def nosyreaction(db, cl, nodeid, oldvalues):
5858
n = {}
5959
for nosyid in nosy: n[nosyid] = 1
6060
change = 0
61-
# but don't add admin to the nosy list
61+
# but don't add admin or the anonymous user to the nosy list
6262
for msgid in messages:
6363
for recipid in db.msg.get(msgid, 'recipients'):
64-
if recipid != '1' and not n.has_key(recipid):
65-
change = 1
66-
nosy.append(recipid)
67-
authid = db.msg.get(msgid, 'author')
68-
if authid != '1' and not n.has_key(authid):
64+
if recipid == '1': continue
65+
if n.has_key(recipid): continue
66+
if db.user.get(recipid, 'username') == 'anonymous': continue
6967
change = 1
70-
nosy.append(authid)
68+
nosy.append(recipid)
69+
authid = db.msg.get(msgid, 'author')
70+
if authid == '1': continue
71+
if n.has_key(authid): continue
72+
if db.user.get(authid, 'username') == 'anonymous': continue
73+
change = 1
74+
nosy.append(authid)
7175
if change:
7276
cl.set(nodeid, nosy=nosy)
7377

@@ -78,6 +82,9 @@ def init(db):
7882

7983
#
8084
#$Log: not supported by cvs2svn $
85+
#Revision 1.3 2001/08/07 00:24:43 richard
86+
#stupid typo
87+
#
8188
#Revision 1.2 2001/08/07 00:15:51 richard
8289
#Added the copyright/license notice to (nearly) all files at request of
8390
#Bizar Software.

roundup/templates/classic/instance_config.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: instance_config.py,v 1.8 2001-10-23 01:00:18 richard Exp $
18+
# $Id: instance_config.py,v 1.9 2001-10-30 00:54:45 richard Exp $
1919

2020
MAIL_DOMAIN=MAILHOST=HTTP_HOST=None
2121
HTTP_PORT=0
@@ -71,8 +71,18 @@
7171
# Deny or allow anonymous users to register through the web interface
7272
ANONYMOUS_REGISTER = 'deny' # either 'deny' or 'allow'
7373

74+
# Send nosy messages to the author of the message
75+
MESSAGES_TO_AUTHOR = 'no' # either 'yes' or 'no'
76+
7477
#
7578
# $Log: not supported by cvs2svn $
79+
# Revision 1.8 2001/10/23 01:00:18 richard
80+
# Re-enabled login and registration access after lopping them off via
81+
# disabling access for anonymous users.
82+
# Major re-org of the htmltemplate code, cleaning it up significantly. Fixed
83+
# a couple of bugs while I was there. Probably introduced a couple, but
84+
# things seem to work OK at the moment.
85+
#
7686
# Revision 1.7 2001/10/22 03:25:01 richard
7787
# Added configuration for:
7888
# . anonymous user access and registration (deny/allow)

roundup/templates/extended/dbinit.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: dbinit.py,v 1.12 2001-10-09 07:25:59 richard Exp $
18+
# $Id: dbinit.py,v 1.13 2001-10-30 00:54:45 richard Exp $
1919

2020
import os
2121

@@ -39,6 +39,7 @@ class IssueClass(roundupdb.IssueClass):
3939
ISSUE_TRACKER_EMAIL = instance_config.ISSUE_TRACKER_EMAIL
4040
ADMIN_EMAIL = instance_config.ADMIN_EMAIL
4141
MAILHOST = instance_config.MAILHOST
42+
MESSAGES_TO_AUTHOR = instance_config.MESSAGES_TO_AUTHOR
4243

4344

4445
def open(name=None):
@@ -175,6 +176,10 @@ def init(adminpw):
175176

176177
#
177178
# $Log: not supported by cvs2svn $
179+
# Revision 1.12 2001/10/09 07:25:59 richard
180+
# Added the Password property type. See "pydoc roundup.password" for
181+
# implementation details. Have updated some of the documentation too.
182+
#
178183
# Revision 1.11 2001/08/07 00:24:43 richard
179184
# stupid typo
180185
#

roundup/templates/extended/detectors/nosyreaction.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: nosyreaction.py,v 1.3 2001-08-07 00:24:43 richard Exp $
18+
#$Id: nosyreaction.py,v 1.4 2001-10-30 00:54:45 richard Exp $
1919

2020
def nosyreaction(db, cl, nodeid, oldvalues):
2121
''' A standard detector is provided that watches for additions to the
@@ -58,16 +58,20 @@ def nosyreaction(db, cl, nodeid, oldvalues):
5858
n = {}
5959
for nosyid in nosy: n[nosyid] = 1
6060
change = 0
61-
# but don't add admin to the nosy list
61+
# but don't add admin or the anonymous user to the nosy list
6262
for msgid in messages:
6363
for recipid in db.msg.get(msgid, 'recipients'):
64-
if recipid != '1' and not n.has_key(recipid):
65-
change = 1
66-
nosy.append(recipid)
67-
authid = db.msg.get(msgid, 'author')
68-
if authid != '1' and not n.has_key(authid):
64+
if recipid == '1': continue
65+
if n.has_key(recipid): continue
66+
if db.user.get(recipid, 'username') == 'anonymous': continue
6967
change = 1
70-
nosy.append(authid)
68+
nosy.append(recipid)
69+
authid = db.msg.get(msgid, 'author')
70+
if authid == '1': continue
71+
if n.has_key(authid): continue
72+
if db.user.get(authid, 'username') == 'anonymous': continue
73+
change = 1
74+
nosy.append(authid)
7175
if change:
7276
cl.set(nodeid, nosy=nosy)
7377

@@ -78,6 +82,9 @@ def init(db):
7882

7983
#
8084
#$Log: not supported by cvs2svn $
85+
#Revision 1.3 2001/08/07 00:24:43 richard
86+
#stupid typo
87+
#
8188
#Revision 1.2 2001/08/07 00:15:51 richard
8289
#Added the copyright/license notice to (nearly) all files at request of
8390
#Bizar Software.

roundup/templates/extended/instance_config.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: instance_config.py,v 1.8 2001-10-23 01:00:18 richard Exp $
18+
# $Id: instance_config.py,v 1.9 2001-10-30 00:54:45 richard Exp $
1919

2020
MAIL_DOMAIN=MAILHOST=HTTP_HOST=None
2121
HTTP_PORT=0
@@ -71,8 +71,18 @@
7171
# Deny or allow anonymous users to register through the web interface
7272
ANONYMOUS_REGISTER = 'deny'
7373

74+
# Send nosy messages to the author of the message
75+
MESSAGES_TO_AUTHOR = 'no' # either 'yes' or 'no'
76+
7477
#
7578
# $Log: not supported by cvs2svn $
79+
# Revision 1.8 2001/10/23 01:00:18 richard
80+
# Re-enabled login and registration access after lopping them off via
81+
# disabling access for anonymous users.
82+
# Major re-org of the htmltemplate code, cleaning it up significantly. Fixed
83+
# a couple of bugs while I was there. Probably introduced a couple, but
84+
# things seem to work OK at the moment.
85+
#
7686
# Revision 1.7 2001/10/22 03:25:01 richard
7787
# Added configuration for:
7888
# . anonymous user access and registration (deny/allow)

0 commit comments

Comments
 (0)