Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Print some details on append and fetch actions.

  • Loading branch information...
commit 81b09d1f010e9a7359183d427573efa64d4a77fa 1 parent 644d698
@lefcha authored
Showing with 65 additions and 0 deletions.
  1. +5 −0 src/mailbox.lua
  2. +60 −0 src/message.lua
View
5 src/mailbox.lua
@@ -797,6 +797,11 @@ function Mailbox.append_message(self, message, flags, date)
r = ifcore.append(self._account._session, self._mailbox, message, flags,
date)
if r == nil then error("append request failed", 0) end
+ if options.info == true and r == true then
+ print(string.format("Appended message of %d octets to %s@%s/%s.",
+ #message, self._account._username,
+ self._account._server, self._mailbox))
+ end
return r
end
View
60 src/message.lua
@@ -35,52 +35,112 @@ end
function Message.fetch_structure(self)
local r = self._mailbox._fetch_structure(self._mailbox, { self._uid })
+ if not r or not r[self._uid] then return end
+ if options.info == true then
+ print(string.format("Fetched the structure of %s@%s/%s[%d].",
+ self._account._username, self._account._server,
+ self._mailbox._mailbox, self._uid))
+ end
return r[self._uid]
end
function Message.fetch_header(self)
local r = self._mailbox._fetch_header(self._mailbox, { self._uid })
+ if not r or not r[self._uid] then return end
+ if options.info == true then
+ print(string.format("Fetched the header of %s@%s/%s[%d].",
+ self._account._username, self._account._server,
+ self._mailbox._mailbox, self._uid))
+ end
return r[self._uid]
end
function Message.fetch_body(self)
local r = self._mailbox._fetch_body(self._mailbox, { self._uid })
+ if not r or not r[self._uid] then return end
+ if options.info == true then
+ print(string.format("Fetched the body of %s@%s/%s[%d].",
+ self._account._username, self._account._server,
+ self._mailbox._mailbox, self._uid))
+ end
return r[self._uid]
end
function Message.fetch_message(self)
local r = self._mailbox._fetch_message(self._mailbox, { self._uid })
+ if not r or not r[self._uid] then return end
+ if options.info == true then
+ print(string.format("Fetched message %s@%s/%s[%d].",
+ self._account._username, self._account._server,
+ self._mailbox._mailbox, self._uid))
+ end
return r[self._uid]
end
function Message.fetch_field(self, field)
local r = self._mailbox._fetch_fields(self._mailbox, { field },
{ self._uid })
+ if not r or not r[self._uid] then return end
+ if options.info == true then
+ print(string.format("Fetched field \"%s\" of %s@%s/%s[%d].", field,
+ self._account._username, self._account._server,
+ self._mailbox._mailbox, self._uid))
+ end
return r[self._uid]
end
function Message.fetch_fields(self, fields)
local r = self._mailbox._fetch_fields(self._mailbox, fields, { self._uid })
+ if not r or not r[self._uid] then return end
+ if options.info == true then
+ print(string.format("Fetched some of the fields of %s@%s/%s[%d].",
+ self._account._username, self._account._server,
+ self._mailbox._mailbox, self._uid))
+ end
return r[self._uid]
end
function Message.fetch_part(self, part)
local r = self._mailbox._fetch_parts(self._mailbox, { part }, self._uid)
+ if not r or not r[part] then return end
+ if options.info == true then
+ print(string.format("Fetched part \"%s\" of %s@%s/%s[%d].", part,
+ self._account._username, self._account._server,
+ self._mailbox._mailbox, self._uid))
+ end
return r[part]
end
function Message.fetch_size(self)
local r = self._mailbox._fetch_size(self._mailbox, { self._uid })
+ if not r or not r[self._uid] then return end
+ if options.info == true then
+ print(string.format("Fetched the size of %s@%s/%s[%d].",
+ self._account._username, self._account._server,
+ self._mailbox._mailbox, self._uid))
+ end
return r[self._uid]
end
function Message.fetch_date(self)
local r = self._mailbox._fetch_date(self._mailbox, { self._uid })
+ if not r or not r[self._uid] then return end
+ if options.info == true then
+ print(string.format("Fetched the date of %s@%s/%s[%d].",
+ self._account._username, self._account._server,
+ self._mailbox._mailbox, self._uid))
+ end
return r[self._uid]
end
function Message.fetch_flags(self)
local r = self._mailbox._fetch_flags(self._mailbox, { self._uid })
+ if not r or not r[self._uid] then return end
+ if options.info == true then
+ print(string.format("Fetched the flags of %s@%s/%s[%d].",
+ self._account._username, self._account._server,
+ self._mailbox._mailbox, self._uid))
+ end
return r[self._uid]
end
Please sign in to comment.
Something went wrong with that request. Please try again.