Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/ashwyn/eden
Browse files Browse the repository at this point in the history
  • Loading branch information
flavour committed Jun 16, 2012
2 parents 90c01b5 + f04b87c commit 9836d01
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions modules/s3/s3msg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1150,6 +1150,7 @@ def fetch_inbound_email(self, username):

inbound_status_table = s3db.msg_inbound_email_status
inbox_table = s3db.msg_email_inbox
log_table = s3db.msg_log

# Read-in configuration from Database
settings = db(s3db.msg_inbound_email_settings.username == username).select(limitby=(0, 1)).first()
Expand Down Expand Up @@ -1221,9 +1222,11 @@ def fetch_inbound_email(self, username):
subject = ""
# Parse out the 'Body'
textParts = msg.get_payload()
body = textParts[0].get_payload()
body = textParts[0]
# Store in DB
inbox_table.insert(sender=sender, subject=subject, body=body)
log_table.insert(sender=sender, subject=subject, message=body, source_task_id=source_task_id)

if delete:
# Add it to the list of messages to delete later
dellist.append(number)
Expand Down Expand Up @@ -1291,9 +1294,11 @@ def fetch_inbound_email(self, username):
subject = ""
# Parse out the 'Body'
textParts = msg.get_payload()
body = textParts[0].get_payload()
body = textParts[0]
# Store in DB
inbox_table.insert(sender=sender, subject=subject, body=body)
log_table.insert(sender=sender, subject=subject, message=body, source_task_id=source_task_id)

if delete:
# Add it to the list of messages to delete later
dellist.append(num)
Expand All @@ -1304,7 +1309,17 @@ def fetch_inbound_email(self, username):
typ, response = M.store(number, "+FLAGS", r"(\Deleted)")
M.close()
M.logout()

# =============================================================================
@staticmethod
def source_id(username):
""" Extracts the source_task_id from a given message. """

db = current.db
table = db["scheduler_task"]
records = db(table.id > 0).select()
for record in records:
if record.vars.split(":") == ["{\"username\""," \"%s\"}" %username] :
return record.id
# =============================================================================
class S3Compose(S3CRUD):
""" RESTful method for messaging """
Expand Down

0 comments on commit 9836d01

Please sign in to comment.