From 36fa11884279cec799973a97a56509e04961df93 Mon Sep 17 00:00:00 2001 From: schmonz Date: Sun, 2 Nov 2008 20:51:40 +0000 Subject: Update to 0.2.8. From the changelog: * Many changes for developers, and many fixes * Added gettext support (thanks blackmoon) * Added support to Windows Event Logging (lwel module) and smart logging facility (smartlog module) * CURL library bindings revamped to version 7.18.1 to help the development of the hotmail plugin * MacOSX startup script fixed, thanks nx2000car * Too many fixes in plugins to be listed, thanks to all contributors --- mail/freepops/Makefile | 5 +- mail/freepops/PLIST | 4 +- mail/freepops/distinfo | 16 +- mail/freepops/patches/patch-aa | 8 +- mail/freepops/patches/patch-af | 6 +- mail/freepops/patches/patch-ag | 6 +- mail/freepops/patches/patch-ah | 1043 ---------------------------------------- mail/freepops/patches/patch-ai | 526 -------------------- 8 files changed, 23 insertions(+), 1591 deletions(-) delete mode 100644 mail/freepops/patches/patch-ah delete mode 100644 mail/freepops/patches/patch-ai (limited to 'mail') diff --git a/mail/freepops/Makefile b/mail/freepops/Makefile index 9090dd835c8..326e75956c6 100644 --- a/mail/freepops/Makefile +++ b/mail/freepops/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.10 2008/10/23 04:40:55 schmonz Exp $ +# $NetBSD: Makefile,v 1.11 2008/11/02 20:51:40 schmonz Exp $ # -DISTNAME= freepops-0.2.7 +DISTNAME= freepops-0.2.8 CATEGORIES= mail MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=freepops/} @@ -52,6 +52,7 @@ FILES_SUBST+= FREEPOPSD_GROUP=${FREEPOPSD_GROUP:Q} PKG_GROUPS_VARS+= FREEPOPSD_GROUP PKG_USERS_VARS+= FREEPOPSD_USER +.include "../../devel/gettext-lib/buildlink3.mk" .include "../../security/openssl/buildlink3.mk" .include "../../textproc/expat/buildlink3.mk" .include "../../www/curl/buildlink3.mk" diff --git a/mail/freepops/PLIST b/mail/freepops/PLIST index 6fc0b6dd278..b4ad1b6b025 100644 --- a/mail/freepops/PLIST +++ b/mail/freepops/PLIST @@ -1,4 +1,4 @@ -@comment $NetBSD: PLIST,v 1.2 2008/10/23 04:40:55 schmonz Exp $ +@comment $NetBSD: PLIST,v 1.3 2008/11/02 20:51:40 schmonz Exp $ bin/freepopsd man/man1/freepopsd.1 share/doc/freepops/MANUAL.txt @@ -36,6 +36,7 @@ share/freepops/lua/popforward.lua share/freepops/lua/psock.lua share/freepops/lua/serial.lua share/freepops/lua/skeleton.lua +share/freepops/lua/smartlog.lua share/freepops/lua/soap/http.lua share/freepops/lua/soap/soap.lua share/freepops/lua/socket.lua @@ -50,6 +51,7 @@ share/freepops/lua/updater.lua share/freepops/lua/updater_common.lua share/freepops/lua/updater_php.lua share/freepops/lua/version_comparer.lua +share/freepops/lua/wel.lua share/freepops/lua/xml2table.lua share/freepops/lua/xml2tex.lua share/freepops/lua/yahoo.lua diff --git a/mail/freepops/distinfo b/mail/freepops/distinfo index 370508ec255..7a5a2f6c4f6 100644 --- a/mail/freepops/distinfo +++ b/mail/freepops/distinfo @@ -1,14 +1,12 @@ -$NetBSD: distinfo,v 1.4 2008/10/23 04:40:55 schmonz Exp $ +$NetBSD: distinfo,v 1.5 2008/11/02 20:51:40 schmonz Exp $ -SHA1 (freepops-0.2.7.tar.gz) = ea6e5836d26388080b3624aa07808abc1917879c -RMD160 (freepops-0.2.7.tar.gz) = 8504d1e2be40a44955c8ad0907f98dcea9d1a6ac -Size (freepops-0.2.7.tar.gz) = 1955240 bytes -SHA1 (patch-aa) = e5fd37ed3009fda5cc033fe9768b97f3023d6200 +SHA1 (freepops-0.2.8.tar.gz) = 5bbf5ed41916c2fee04938abb0c440d98b325710 +RMD160 (freepops-0.2.8.tar.gz) = e209a2b2f289e5b431c1d5ab3aaf5d5b09a87135 +Size (freepops-0.2.8.tar.gz) = 2062296 bytes +SHA1 (patch-aa) = ebe6913847ac9c7a9746496705b6ac45ace6eeef SHA1 (patch-ab) = 59faa97775853f795f024585e194a060a3f3ee94 SHA1 (patch-ac) = ca0c136b6cee3c164c9382227bcbd534e382927b SHA1 (patch-ad) = 90a2313b2e9a3a2321778df515c076e603955502 SHA1 (patch-ae) = 389693569e978395f2d1e286003ad7d20ce59a14 -SHA1 (patch-af) = 68bacbbb3dca7b7e676caee54fc7610c6b280f10 -SHA1 (patch-ag) = 6be408e7c065d9cf32f727e1cbd016b7ce60e202 -SHA1 (patch-ah) = e54224faa6e803e0dd858211416fb5be151d7474 -SHA1 (patch-ai) = 36285e7b1fe68511ad65302a94f2c71e8f348323 +SHA1 (patch-af) = b0a084f1db0f39a4f29cd071765b7d4e6bf21198 +SHA1 (patch-ag) = 9c7f944d0f2f5a5303e692844b729e933655f9f4 diff --git a/mail/freepops/patches/patch-aa b/mail/freepops/patches/patch-aa index 428e80b1f36..11f052b1423 100644 --- a/mail/freepops/patches/patch-aa +++ b/mail/freepops/patches/patch-aa @@ -1,8 +1,8 @@ -$NetBSD: patch-aa,v 1.3 2008/10/23 04:40:55 schmonz Exp $ +$NetBSD: patch-aa,v 1.4 2008/11/02 20:51:40 schmonz Exp $ ---- configure.sh.orig 2008-06-11 13:33:56.000000000 -0400 +--- configure.sh.orig 2008-08-27 09:11:14.000000000 -0400 +++ configure.sh -@@ -75,6 +75,13 @@ LUAFLAGS=${LUAFLAGS:-""} +@@ -76,6 +76,13 @@ LUAFLAGS=${LUAFLAGS:-""} OSX_SDK=${OSX_SDK:-""} } @@ -16,7 +16,7 @@ $NetBSD: patch-aa,v 1.3 2008/10/23 04:40:55 schmonz Exp $ set_linux() { set_default OS=Linux -@@ -253,6 +260,9 @@ case $1 in +@@ -255,6 +262,9 @@ case $1 in usage exit 1 ;; diff --git a/mail/freepops/patches/patch-af b/mail/freepops/patches/patch-af index e995722744e..34ebca0a5d8 100644 --- a/mail/freepops/patches/patch-af +++ b/mail/freepops/patches/patch-af @@ -1,10 +1,10 @@ -$NetBSD: patch-af,v 1.3 2008/10/23 04:40:55 schmonz Exp $ +$NetBSD: patch-af,v 1.4 2008/11/02 20:51:40 schmonz Exp $ ---- config.h.orig 2008-05-27 10:22:49.000000000 -0400 +--- config.h.orig 2008-07-25 04:37:47.000000000 -0400 +++ config.h @@ -16,7 +16,7 @@ // common - #define VERSION "0.2.7" + #define VERSION "0.2.8" #define PROGRAMNAME "FreePOPs" -#define PIDFILE "/var/run/freepopsd.pid" +#define PIDFILE "@VARBASE@/run/freepopsd.pid" diff --git a/mail/freepops/patches/patch-ag b/mail/freepops/patches/patch-ag index 0fa7aab71d5..5194abebf60 100644 --- a/mail/freepops/patches/patch-ag +++ b/mail/freepops/patches/patch-ag @@ -1,8 +1,8 @@ -$NetBSD: patch-ag,v 1.3 2008/10/23 04:40:55 schmonz Exp $ +$NetBSD: patch-ag,v 1.4 2008/11/02 20:51:40 schmonz Exp $ ---- src/Makefile.orig 2008-06-04 14:33:02.000000000 -0400 +--- src/Makefile.orig 2008-11-01 10:25:38.000000000 -0400 +++ src/Makefile -@@ -169,7 +169,7 @@ ifeq "$(OS)" "BeOS" +@@ -172,7 +172,7 @@ ifeq "$(OS)" "BeOS" else ifeq "$(SSL)" "openssl" LDFLAGS+=-L ../modules/lib $(addprefix -l,$(LIBSTOLINK))\ diff --git a/mail/freepops/patches/patch-ah b/mail/freepops/patches/patch-ah deleted file mode 100644 index b1bde48dcd3..00000000000 --- a/mail/freepops/patches/patch-ah +++ /dev/null @@ -1,1043 +0,0 @@ -$NetBSD: patch-ah,v 1.1 2008/10/23 04:40:55 schmonz Exp $ - ---- src/lua/hotmail.lua.orig 2008-05-27 10:23:22.000000000 -0400 -+++ src/lua/hotmail.lua -@@ -3,13 +3,11 @@ - -- - -- Released under the GNU/GPL license - -- Written by Russell Schwager ---- Patched by cdmackie (2007-09-11). ---- Fixed: lite login, live delete, corrupt messages, stuck at 1st message, classic delete more than 1 message - -- ************************************************************************** -- - - -- Globals - -- --PLUGIN_VERSION = "0.1.90" -+PLUGIN_VERSION = "0.1.92" - PLUGIN_NAME = "hotmail.com" - PLUGIN_REQUIRE_VERSION = "0.2.0" - PLUGIN_LICENSE = "GNU/GPL" -@@ -21,7 +19,8 @@ PLUGIN_DOMAINS = { "@hotmail.com","@msn. - "@charter.com", "@compaq.net","@passport.com", - "@hotmail.de", "@hotmail.it", "@hotmail.co.uk", - "@hotmail.co.jp", "@hotmail.fr", "@messengeruser.com", -- "@hotmail.com.ar", "@hotmail.co.th", "@hotmail.com.tr" -+ "@hotmail.com.ar", "@hotmail.co.th", "@hotmail.com.tr", -+ "@milanosemplice.it" - } - PLUGIN_PARAMETERS = { - {name="folder", description={ -@@ -106,9 +105,9 @@ local globals = { - -- - strRetLoginBadLogin = "(memberservices)", - strRetLoginSessionExpired = "(Sign in)", -- strRetLoginSessionExpiredLiveLight = '(=on - strCmdDeleteLive = "http://%s/mail/mail.fpp?cnmn=Microsoft.Msn.Hotmail.Ui.Fpp.MailBox.MoveMessages&ptid=0&a=%s&au=%s", - strCmdDeletePostLiveOld = 'cn=Microsoft.Msn.Hotmail.Ui.Fpp.MailBox&mn=MoveMessages&d="%s","%s",[%s],[{"%%5C%%7C%%5C%%7C%%5C%%7C0%%5C%%7C%%5C%%7C%%5C%%7C00000000-0000-0000-0000-000000000001%%5C%%7C632901424233870000",{2,"00000000-0000-0000-0000-000000000000",0}}],null,null,0,false,Date&v=1', - -- strCmdDeletePostLive = 'cn=Microsoft.Msn.Hotmail.Ui.Fpp.MailBox&mn=MoveMessages&d="%s","%s",[%s],[{"%%5C%%7C%%5C%%7C%%5C%%7C0%%5C%%7C%%5C%%7C%%5C%%7C%%5C%%7C00000000-0000-0000-0000-000000000001%%5C%%7C632750213035330000",null}],null,null,0,false,Date,false,true&v=1&mt=%s', - strCmdDeletePostLive = 'cn=Microsoft.Msn.Hotmail.Ui.Fpp.MailBox&mn=MoveMessages&d="%s","%s",[%s],[{"0%%5C%%7C0%%5C%%7C8C9BDFF65883200%%5C%%7C00000000-0000-0000-0000-000000000001",null}],null,null,0,false,Date,false,true&v=1&mt=%s', -- strCmdDeleteLiveLight = "http://%s/mail/InboxLight.aspx?FolderID=%s&", -- strCmdDeletePostLiveLight = "__VIEWSTATE=&mt=%s&MoveMessageSelector=%s&ToolbarActionItem=MoveMessageSelector&", -- SelectedMessages=%s", -+ -+ --strCmdDeleteLiveLight = "http://%s/mail/InboxLight.aspx?FolderID=%s&", -+ --strCmdDeletePostLiveLight = "__VIEWSTATE=&mt=%s&MoveMessageSelector=%s&ToolbarActionItem=MoveMessageSelector&", -- SelectedMessages=%s", -+ strCmdDeleteLiveLight = "http://%s/mail/mail.fpp?cnmn=Microsoft.Msn.Hotmail.Ui.Fpp.MailBox.MoveMessagesToFolder&ptid=0&a=%s&au=%s", -+ strCmdDeletePostLiveLight = 'cn=Microsoft.Msn.Hotmail.Ui.Fpp.MailBox&mn=MoveMessagesToFolder&d="%s","%s",[%s],[%s],{"%s",25,FirstPage,0,Date,false,"00000000-0000-0000-0000-000000000000","",1,2,false,"",false,0},null&v=1&mt=%s', -+ strCmdDeletePostLiveLight2 = 'cn=Microsoft.Msn.Hotmail.Ui.Fpp.MailBox&mn=MoveMessagesToFolder&d="%s","%s",[%s],[%s],{"%s",FirstPage,0,Date,false,"00000000-0000-0000-0000-000000000000","",1,2,false,"",26,0,Bottom}&v=1&mt=%s', -+ - strCmdMsgView = "http://%s/cgi-bin/getmsg?msg=%s&imgsafe=y&curmbox=%s&a=%s", - strCmdMsgViewRaw = "&raw=0", - strCmdMsgViewLive = "http://%s/mail/GetMessageSource.aspx?msgid=%s&gs=true", -@@ -253,11 +273,13 @@ local globals = { - strCmdMsgUnreadLivePost = "cn=Microsoft.Msn.Hotmail.Ui.Fpp.MailBox&mn=MarkMessages&d=false,[%s]", - strCmdEmptyTrashLive = "http://%s/mail/mail.fpp?cnmn=Microsoft.Msn.Hotmail.Ui.Fpp.MailBox.EmptyFolder&ptid=0&a=&au=%s", - strCmdEmptyTrashLivePost = "cn=Microsoft.Msn.Hotmail.Ui.Fpp.MailBox&mn=EmptyFolder&d=%s,1&v=1&mt=%s", -- strCmdEmptyTrashLiveLight = "http://%s/mail/InboxLight.aspx?EmptyFolder=True&FolderID=%s&", -- strCmdEmptyTrashLiveLightPost = "__VIEWSTATE=&mt=%s&query=&MoveMessageSelector=&ToolbarActionItem=&InfoPaneActionItem=EmptyFolderConfirmYes", -+ strCmdEmptyTrashLiveLight = "http://%s/mail/mail.fpp?cnmn=Microsoft.Msn.Hotmail.Ui.Fpp.MailBox.ClearFolder&ptid=0&a=%s&au=%s", -+ strCmdEmptyTrashLiveLightPost = 'cn=Microsoft.Msn.Hotmail.Ui.Fpp.MailBox&mn=ClearFolder&d="%s",{"%s",25,FirstPage,0,Date,false,"00000000-0000-0000-0000-000000000000","",1,2,false,"",false,0}&v=1&mt=%s', - strCmdMsgReadLive = "http://%s/mail/mail.fpp?cnmn=Microsoft.Msn.Hotmail.Ui.Fpp.MailBox.MarkMessages&ptid=0&a=&au=%s", - strCmdMsgReadLivePost = "cn=Microsoft.Msn.Hotmail.Ui.Fpp.MailBox&mn=MarkMessages&d=true,[%s]&v=1&mt=%s", -- strCmdMsgReadLiveLight = "http://%s/mail/ReadMessageLight.aspx?AllowUnsafe=True&Aux=&FolderID=%s&InboxSortAscending=False&InboxSortBy=Date&ReadMessageId=%s", -+ --strCmdMsgReadLiveLight = "http://%s/mail/ReadMessageLight.aspx?AllowUnsafe=True&Aux=&FolderID=%s&InboxSortAscending=False&InboxSortBy=Date&ReadMessageId=%s", -+ strCmdMsgReadLiveLight = "http://%s/mail/mail.fpp?cnmn=Microsoft.Msn.Hotmail.Ui.Fpp.MailBox.MarkMessagesReadState&ptid=0&a=%s&au=%s", -+ strCmdMsgReadLiveLightPost = 'cn=Microsoft.Msn.Hotmail.Ui.Fpp.MailBox&mn=MarkMessagesReadState&d=true,["%s"],{"%s",25,FirstPage,0,Date,false,"00000000-0000-0000-0000-000000000000","",1,2,false,"",false,0}&v=1&mt=%s', - } - - -- ************************************************************************** -- -@@ -288,6 +310,8 @@ internalState = { - strUserId = "", - strMT = "", - bKeepMsgStatus = false, -+ msgIds = {}, -+ unreadStatus = {}, - } - - -- ************************************************************************** -- -@@ -354,6 +378,13 @@ end - - function getPage(browser, url, post, name) - local try = 0 -+ -+ if post ~= nil then -+ log.raw("LOADING: " .. url .. "\nPOST: " .. post .. "\n") -+ else -+ log.raw("LOADING: " .. url .. "\n") -+ end -+ - while (try < 3) do - try = try + 1 - local body, err = fetchPage(browser, url, post, name) -@@ -363,9 +394,11 @@ function getPage(browser, url, post, nam - log.error_print("Tried to load: " .. url .. " and got error: " .. err) - return nil, err - else -+ log.raw(body .. "\n\n") -+ - if (string.find(body, "We are experiencing higher than normal volume") == nil and -- string.find(body, "<[Hh][Tt][Mm][Ll]") ~= nil and -- string.find(body, "MSN Hotmail %- ERROR") == nil) then -+ (string.find(body, "<[Hh][Tt][Mm][Ll]") ~= nil or string.find(body, "new HM.FppReturnPackage") ~= nil) and -+ string.find(body, "MSN Hotmail %- ERROR") == nil ) then - return body, err - end - -- This is a little bizarre -- It seems the condition should not be here. -@@ -383,11 +416,23 @@ end - - function fetchPage(browser, url, post, name) - log.dbg("Fetching Page: " .. name .. " - " .. url) -+ local body, err - if (post == nil) then -- return browser:get_uri(url) -+ body, err = browser:get_uri(url) - else -- return browser:post_uri(url, post) -+ body, err = browser:post_uri(url, post) - end -+ -+ local lastpage = browser:whathaveweread() -+ if (string.match(lastpage, "browsersupport")) then -+ if (post == nil) then -+ body, err = browser:get_uri(url) -+ else -+ body, err = browser:post_uri(url, post) -+ end -+ end -+ -+ return body, err - end - - -- Issue the command to login to Hotmail -@@ -403,8 +448,8 @@ function loginHotmail() - - -- Create a browser to do the dirty work - -- -- --internalState.browser = browser.new("Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; YPC 3.0.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727") -- internalState.browser = browser.new("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.12) Gecko/20080207 Ubuntu/7.10 (gutsy) Firefox/2.0.0.12") -+ internalState.browser = browser.new("Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/522.11.3 (KHTML, like Gecko) Version/3.0 Safari/522.11.3") -+ --internalState.browser = browser.new("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.12) Gecko/20080207 Ubuntu/7.10 (gutsy) Firefox/2.0.0.12") - - -- Define some local variables - -- -@@ -520,6 +565,21 @@ function loginHotmail() - body, err = getPage(browser, "http://www.hotmail.com", nil, "hotmail homepage") - end - -+ -- Let's look for a message at login -+ -- -+ local hasMsgAtLogin = false -+ url = string.match(body, '
\r\n" -+ newheaders = newheaders .. "Message-ID: <" .. msgid .. ">\r\n" -+ end -+ -+ local readStatus = "read" -+ if (internalState.unreadStatus[cbInfo.cb_uidl]) then -+ readStatus = "unread" - end - -- headers = headers .. "X-FreePOPs-User: " .. internalState.strUser .. "@" .. internalState.strDomain .. "\r\n" -- headers = headers .. "X-FreePOPs-Domain: " .. internalState.strDomain .. "\r\n" -- headers = headers .. "X-FreePOPs-Folder: " .. internalState.strMBox .. "\r\n" -- headers = headers .. "X-FreePOPs-MailServer: " .. internalState.strMailServer .. "\r\n" -- headers = headers .. "X-FreePOPs-ImageServer: " .. internalState.strImgServer .. "\r\n" -- headers = headers .. "X-FreePOPs-MsgNumber: " .. "<" .. cbInfo.cb_uidl .. ">" .. "\r\n" -+ newheaders = newheaders .. "X-FreePOPs-User: " .. internalState.strUser .. "@" .. internalState.strDomain .. "\r\n" -+ newheaders = newheaders .. "X-FreePOPs-Domain: " .. internalState.strDomain .. "\r\n" -+ newheaders = newheaders .. "X-FreePOPs-Folder: " .. internalState.strMBox .. "\r\n" -+ newheaders = newheaders .. "X-FreePOPs-MailServer: " .. internalState.strMailServer .. "\r\n" -+ newheaders = newheaders .. "X-FreePOPs-ImageServer: " .. internalState.strImgServer .. "\r\n" -+ newheaders = newheaders .. "X-FreePOPs-MsgNumber: " .. "<" .. cbInfo.cb_uidl .. ">" .. "\r\n" -+ newheaders = newheaders .. "X-FREEPOPS-READ-STATUS: " .. readStatus .. "\r\n" - - -- make the final touch... - -- -- headers = headers .. "\r\n" .. bodyrest -+ headers = headers .. "\r\n" .. newheaders .. bodyrest - - return headers - end -@@ -1127,13 +1219,16 @@ function cleanupBody(body, cbInfo) - -- - body = string.gsub(body, "
[%s]*", "")
-   body = string.gsub(body, "
.-$", "\n") -+ -- cdmackie: sometimes we get only " 255) then -+ return "&#" .. c .. ";" -+ else -+ return string.char(c) -+ end -+ end -+ ) -+ - -- We've now at least seen one block, attempt to clean up the headers - -- - if (cbInfo.bFirstBlock == true) then -@@ -1397,6 +1500,7 @@ function quit_update(pstate) - local post = postBase - local uidls = "" - local uidlsLight = "" -+ local madsLight = "" - - -- Cycle through the messages and see if we need to delete any of them - -- -@@ -1420,8 +1524,15 @@ function quit_update(pstate) - post = postBase - end - elseif internalState.bLiveGUI == true and internalState.bLiveLightGUI and get_mailmessage_flag(pstate, i, MAILMESSAGE_DELETE) then -- -- cdmackie: uidlsLight should be appended for multiple messages -- uidlsLight = uidlsLight .. "SelectedMessages=" .. get_mailmessage_uidl(pstate, i) .. "&" -+ -- cdmackie: 2008-07-09 string contains UIDLS and "mad" attribute from inbox -+ local uidl, mad = string.match(internalState.msgIds[i], "(.-)&(.*)") -+ if i > 1 then -+ uidlsLight = uidlsLight .. ',"' .. uidl .. '"' -+ madsLight = madsLight .. ',{"' .. mad .. '",null}' -+ else -+ uidlsLight = '"' .. uidl .. '"' -+ madsLight = '{"' .. mad .. '",null}' -+ end - dcnt = dcnt + 1 - elseif internalState.bLiveGUI == true and get_mailmessage_flag(pstate, i, MAILMESSAGE_DELETE) then - if i > 1 then -@@ -1442,12 +1553,29 @@ function quit_update(pstate) - log.error_print("Unable to delete messages.\n") - end - elseif dcnt > 0 and internalState.bLiveGUI and internalState.bLiveLightGUI == true then -- cmdUrl = string.format(globals.strCmdDeleteLiveLight, internalState.strMailServer, internalState.strMBox) -- post = string.format(globals.strCmdDeletePostLiveLight, internalState.strMT, -- internalState.strTrashId) .. uidlsLight -+ cmdUrl = string.format(globals.strCmdDeleteLiveLight, internalState.strMailServer, internalState.strCrumb, internalState.strUserId) -+ -+ -- This is the older interface's way to delete it. -+ -- -+ local inboxid = string.gsub(internalState.strMBox, "&n=.*", "") -+ post = string.format(globals.strCmdDeletePostLiveLight, -+ inboxid, internalState.strTrashId, -+ uidlsLight, madsLight, -+ inboxid, internalState.strMT) -+ post = string.gsub(post, '"', "%%22") - log.dbg("Sending Trash url: " .. cmdUrl .. " - " .. post) - local body, err = getPage(browser, cmdUrl, post, "Delete Messages - LiveLight") -- elseif dcnt > 0 and internalState.bLiveGUI then -+ -+ -- This is less than ideal and will need to be fixed soon. This is the newer way to delete. -+ -- -+ post = string.format(globals.strCmdDeletePostLiveLight2, -+ inboxid, internalState.strTrashId, -+ uidlsLight, madsLight, -+ inboxid, internalState.strMT) -+ post = string.gsub(post, '"', "%%22") -+ local body, err = getPage(browser, cmdUrl, post, "Delete Messages - LiveLight - Newer version") -+ -+ elseif dcnt > 0 and internalState.bLiveGUI then - cmdUrl = string.format(globals.strCmdDeleteLive, internalState.strMailServer, internalState.strCrumb, internalState.strUserId) - uidls = string.gsub(uidls, ",", '","') - uidls = '"' .. uidls .. '"' -@@ -1476,9 +1604,11 @@ function quit_update(pstate) - log.error_print("Cannot empty trash - crumb not found\n") - end - elseif internalState.bEmptyTrash and internalState.bLiveGUI and internalState.bLiveLightGUI == true then -- cmdUrl = string.format(globals.strCmdEmptyTrashLiveLight, internalState.strMailServer, internalState.strTrashId) -- local post = string.format(globals.strCmdEmptyTrashLiveLightPost, internalState.strMT) -- log.dbg("Sending Empty Trash URL: " .. cmdUrl .."\n") -+ cmdUrl = string.format(globals.strCmdEmptyTrashLiveLight, internalState.strMailServer, internalState.strCrumb, internalState.strUserId) -+ local inboxid = string.gsub(internalState.strMBox, "&n=.*", "") -+ local post = string.format(globals.strCmdEmptyTrashLiveLightPost,internalState.strTrashId, inboxid, internalState.strMT) -+ post = string.gsub(post, '"', "%%22") -+ log.dbg("Sending Empty Trash URL: " .. cmdUrl ..", POST: " .. post .. "\n") - local body, err = getPage(browser, cmdUrl, post, "LiveLight - Empty Trash") - if not body or err then - log.error_print("Error when trying to empty the trash with url: ".. cmdUrl .."\n") -@@ -1496,9 +1626,11 @@ function quit_update(pstate) - -- Empty the Junk Folder - -- - if internalState.bEmptyJunk and internalState.bLiveGUI and internalState.bLiveLightGUI == true then -- cmdUrl = string.format(globals.strCmdEmptyTrashLiveLight, internalState.strMailServer, internalState.strJunkId) -- local post = string.format(globals.strCmdEmptyTrashLiveLightPost, internalState.strMT) -- log.dbg("Sending Empty Junk URL: " .. cmdUrl .."\n") -+ cmdUrl = string.format(globals.strCmdEmptyTrashLiveLight, internalState.strMailServer, internalState.strCrumb, internalState.strUserId) -+ local inboxid = string.gsub(internalState.strMBox, "&n=.*", "") -+ local post = string.format(globals.strCmdEmptyTrashLiveLightPost,internalState.strJunkId, inboxid, internalState.strMT) -+ post = string.gsub(post, '"', "%%22") -+ log.dbg("Sending Empty Junk URL: " .. cmdUrl ..", POST: " .. post .. "\n") - local body, err = getPage(browser, cmdUrl, post, "LiveLight - Empty Junk") - if not body or err then - log.error_print("Error when trying to empty the junk folder with url: ".. cmdUrl .."\n") -@@ -1592,7 +1724,7 @@ function LiveStat(pstate) - post = string.format(globals.strCmdMsgListPostLiveOld, internalState.strMBox, nMaxMsgs, nMaxMsgs) - body, err = browser:post_uri(cmdUrl, post) - end -- log.raw(body) -+ --log.raw(body) - - -- Let's make sure the session is still valid - -- -@@ -1608,7 +1740,7 @@ function LiveStat(pstate) - else - strLog = strLog .. ": " .. body - end -- log.raw(strLog) -+ --log.raw(strLog) - - -- Try Logging back in - -- -@@ -1632,10 +1764,7 @@ function LiveStat(pstate) - for uidl, size in string.gfind(body, globals.strMsgLivePatternOld) do - nMsgs = nMsgs + 1 - if (nMsgs <= nMaxMsgs) then -- log.dbg("Processed STAT - Msg: " .. nMsgs .. ", UIDL: " .. uidl .. ", Size: " .. size) -- set_popstate_nummesg(pstate, nMsgs) -- set_mailmessage_size(pstate, nMsgs, size) -- set_mailmessage_uidl(pstate, nMsgs, uidl) -+ processMessage(uidl, sizes[i], nMsgs, pstate) - end - end - -@@ -1666,11 +1795,7 @@ function LiveStat(pstate) - for uidl in string.gfind(body, globals.strMsgLivePattern2) do - nMsgs = nMsgs + 1 - if (nMsgs <= nMaxMsgs) then -- log.dbg("Processed STAT - Msg: " .. nMsgs .. ", UIDL: " .. uidl .. ", Size: " .. sizes[i]) -- -- set_popstate_nummesg(pstate, nMsgs) -- set_mailmessage_size(pstate, nMsgs, sizes[i]) -- set_mailmessage_uidl(pstate, nMsgs, uidl) -+ processMessage(uidl, sizes[i], nMsgs, pstate) - i = i + 1 - end - end -@@ -1706,6 +1831,7 @@ function stat(pstate) - local nTotMsgs = 0 - local lastNMsgs = 0 - local cmdUrl = "" -+ local cmdUrlPost = nil - if (internalState.bLiveLightGUI) then - cmdUrl = string.format(globals.strCmdMsgListLiveLight, internalState.strMailServer, - internalState.strMBox); -@@ -1715,6 +1841,7 @@ function stat(pstate) - end - local baseUrl = cmdUrl - local nextPageUrl = nil -+ local nextPageUrlPost = nil - - -- Keep a list of IDs that we've seen. With yahoo, their message list can - -- show messages that we've already seen. This, although a bit hacky, will -@@ -1722,6 +1849,9 @@ function stat(pstate) - -- really sucks! - -- - local knownIDs = {} -+ -+ -- keep msgIds for Hotmail to include the n value -+ internalState.msgIds = {} - - -- Debug Message - -- -@@ -1777,33 +1907,13 @@ function stat(pstate) - break - end - end -- -- -- Convert the size from it's string (4KB or 2MB) to bytes -- -- First figure out the unit (KB or just B) -- -- -- local kbUnit = string.match(size, "([Kk])") -- size = string.match(size, "([%d%.,]+)[KkMm]") -- if (size ~= nil) then -- size = string.gsub(size, ",", ".") -- end -- if (size ~= nil and tonumber(size) ~= nil) then -- if not kbUnit then -- size = math.max(tonumber(size), 0) * 1024 * 1024 -- else -- size = math.max(tonumber(size), 0) * 1024 -- end -- else -- size = 1024 -- end -+ size = parseSize(size) - - -- Save the information - -- - if bUnique == true and ((nMsgs < nTotMsgs and nTotMsgs ~= 0) or nTotMsgs == 0) then - nMsgs = nMsgs + 1 -- log.dbg("Processed STAT - Msg: " .. nMsgs .. ", UIDL: " .. uidl .. ", Size: " .. size) -- set_popstate_nummesg(pstate, nMsgs) -- set_mailmessage_size(pstate, nMsgs, size) -- set_mailmessage_uidl(pstate, nMsgs, uidl) -+ processMessage(uidl, size, nMsgs, pstate) - knownIDs[nMsgs] = uidl - end - end -@@ -1820,27 +1930,64 @@ function stat(pstate) - -- - local function funcProcessLiveLight(body) - lastNMsgs = nMsgs -- -+ - -- Figure out if there are more pages with messages - -- - nextPageUrl = string.match(body, globals.strMsgListNextPagePatLiveLight) -+ -- cdmackie 2008-07-02: qw now have to build post for subsequent page calls -+ nextPageUrlPost = nil -+ if nextPageUrl == nil then -+ local startpos, endpos, pcur, pnam, pnad, pnmid = string.find(body, globals.strMsgListNextPagePatLiveLight3) -+ local pattern4Use = false -+ if (startpos == nil) then -+ startpos, endpos, pcur, pnam, pnad, pnmid = string.find(body, globals.strMsgListNextPagePatLiveLight4) -+ pattern4Use = true -+ end -+ if startpos ~= nil then -+ nextPageUrl = string.format(globals.strCmdMsgListLive3, internalState.strCrumb, internalState.strUserId) -+ local inboxid = string.gsub(internalState.strMBox, "&n=.*", "") -+ pnad = cleanupLoginBody(pnad) -- replace : with colons -+ pnad = string.gsub(pnad, ":", "%%5C%%3A") -- replace colons with %5C%3A -+ if pattern4Use then -+ nextPageUrlPost = string.format(globals.strCmdMsgListPostLive4, inboxid, pnam, pnad, pcur, pnmid, nTotMsgs, internalState.strMT) -+ else -+ nextPageUrlPost = string.format(globals.strCmdMsgListPostLive3, inboxid, pnam, pnad, pcur, pnmid, nTotMsgs, internalState.strMT) -+ end -+ end -+ end - -- cdmackie: change in hotmail nextpage link (kept old one incase still used) - if nextPageUrl == nil then - nextPageUrl = string.match(body, globals.strMsgListNextPagePatLiveLight2) - end - if (nextPageUrl ~= nil) then -- log.dbg("Found another page of messages: " .. nextPageUrl) -+ if (nextPageUrlPost ~= nil) then -+ log.dbg("Found another page of messages: " .. nextPageUrl .. ", POST:" .. nextPageUrlPost) -+ else -+ log.dbg("Found another page of messages: " .. nextPageUrl) -+ end - end - - -- Tokenize out the message ID and size for each item in the list - -- -- for uidl, size in string.gfind(body, globals.strMsgLiveLightPattern) do -+ -- cdmackie 2008-07-02: new message patterns and different for first and ajax calls -+ for msgrow, msgcells in string.gfind(body, globals.strMsgLiveLightPattern) do -+ local mad = string.match(msgrow, globals.strMsgLiveLightPatternMad) -+ local uidl = string.match(msgrow, globals.strMsgLiveLightPatternUidl) -+ local fulluidl = uidl .. "&" .. mad -+ local size = string.match(msgcells, globals.strMsgLiveLightPatternSize) -+ if (size == nil) then -+ size = "1 KB" -- Some versions of hotmail don't display the size. -+ end - - if not uidl or not size then - log.say("Hotmail Module needs to fix it's individual message list pattern matching.\n") - return nil, "Unable to parse the size and uidl from the html" - end - -+ if (string.match(msgrow, globals.strMsgLiveLightPatternUnread)) then -+ internalState.unreadStatus[uidl] = true -+ end -+ - local bUnique = true - for j = 0, nMsgs do - if knownIDs[j + 1] == uidl then -@@ -1848,37 +1995,45 @@ function stat(pstate) - break - end - end -+ size = parseSize(size) - -- -- Convert the size from it's string (4KB or 2MB) to bytes -- -- First figure out the unit (KB or just B) -+ -- Save the information - -- -- local kbUnit = string.match(size, "([Kk])") -- size = string.match(size, "([%d%.,]+)[KkMm]") -- if (size ~= nil) then -- size = string.gsub(size, ",", ".") -- end -- if (size ~= nil and tonumber(size) ~= nil) then -- if not kbUnit then -- size = math.max(tonumber(size), 0) * 1024 * 1024 -- else -- size = math.max(tonumber(size), 0) * 1024 -- end -- else -- size = 1024 -+ if bUnique == true and ((nMsgs < nTotMsgs and nTotMsgs ~= 0) or nTotMsgs == 0) then -+ nMsgs = nMsgs + 1 -+ processMessage(uidl, size, nMsgs, pstate) -+ knownIDs[nMsgs] = uidl -+ internalState.msgIds[nMsgs] = fulluidl -+ end -+ end -+ -+ -- Some accounts haven't been upgraded to the newer version of the live light interface and thus, we need to make a second chec. -+ -- This is terrible and needs to be removed when it can be! -+ for uidl, size in string.gfind(body, globals.strMsgLiveLightPatternOld) do -+ if not uidl or not size then -+ log.say("Hotmail Module needs to fix it's individual message list pattern matching.\n") -+ return nil, "Unable to parse the size and uidl from the html" -+ end -+ -+ local bUnique = true -+ for j = 0, nMsgs do -+ if knownIDs[j + 1] == uidl then -+ bUnique = false -+ break -+ end - end -+ size = parseSize(size) - - -- Save the information - -- - if bUnique == true and ((nMsgs < nTotMsgs and nTotMsgs ~= 0) or nTotMsgs == 0) then - nMsgs = nMsgs + 1 -- log.dbg("Processed STAT - Msg: " .. nMsgs .. ", UIDL: " .. uidl .. ", Size: " .. size) -- set_popstate_nummesg(pstate, nMsgs) -- set_mailmessage_size(pstate, nMsgs, size) -- set_mailmessage_uidl(pstate, nMsgs, uidl) -+ processMessage(uidl, size, nMsgs, pstate) - knownIDs[nMsgs] = uidl -+ internalState.msgIds[nMsgs] = uidl - end -- end -- -+ end -+ - -- We are done with this page, increment the counter - -- - nPage = nPage + 1 -@@ -1890,16 +2045,24 @@ function stat(pstate) - -- change the command url - -- - local function funcCheckForMorePages(body) -- -- -+ -- Prevent an infinite loop -+ -- -+ if (lastNMsgs == nMsgs) then -+ return true -+ end -+ - if (internalState.bLiveLightGUI) then - if (nextPageUrl == nil) then - return true -- else -- cmdUrl = "http://" .. internalState.strMailServer .. "/mail/" .. nextPageUrl -+ else -+ if (string.match(nextPageUrl, "^http") == nil) then -+ cmdUrl = "http://" .. internalState.strMailServer .. "/mail/" .. nextPageUrl -+ end -+ cmdUrlPost = nextPageUrlPost - return false - end - end -- -+ - -- See if there are messages remaining - -- - if nMsgs < nTotMsgs then -@@ -1908,10 +2071,6 @@ function stat(pstate) - else - -- For western languages, our patterns don't work so use a backup pattern. - -- -- if (lastNMsgs == nMsgs) then -- return true -- end -- - if (nTotMsgs == 0 and - string.find(body, globals.strMsgListNextPagePattern) ~= nil) then - cmdUrl = baseUrl .. string.format(globals.strCmdMsgListNextPage, nPage) -@@ -1930,7 +2089,7 @@ function stat(pstate) - - -- Get the page and check to see if we got results - -- -- local body, err = getPage(browser, cmdUrl, nil, "STAT Page - LiveLight and NonLive") -+ local body, err = getPage(browser, cmdUrl, cmdUrlPost, "STAT Page - LiveLight and NonLive") - if body == nil then - return body, err - end -@@ -1944,9 +2103,21 @@ function stat(pstate) - - -- Is the session expired - -- -- local strSessExpr = string.match(body, globals.strRetLoginSessionExpired) -- local strSessExprLight = string.match(body, globals.strRetLoginSessionExpiredLiveLight) -- if strSessExpr ~= nil or strSessExprLight == nil then -+ -- dhh 2008-07-05: fix for non live light interface. -+ local bSessionExpired = false -+ if (internalState.bLiveLightGUI == false) then -+ local strSessExpr = string.match(body, globals.strRetLoginSessionExpired) -+ if strSessExpr ~= nil then -+ bSessionExpired = true -+ end -+ else -+ local strSessExprLight = string.match(body, globals.strRetLoginSessionExpiredLiveLight) -+ local strSessExprLive = string.match(body, globals.strRetLoginSessionExpiredLive) -+ if strSessExprLight == nil and strSessExprLive == nil then -+ bSessionExpired = true -+ end -+ end -+ if bSessionExpired == true then - -- Invalidate the session - -- - internalState.bLoginDone = nil -@@ -1981,6 +2152,16 @@ function stat(pstate) - return getPage(browser, cmdUrl, nil, "STAT Page - LiveLight and NonLive") - end - -+ -- cdmackie 2008-07-02: live light needs crumb now -+ if (internalState.bLiveLightGUI) then -+ if internalState.strCrumb == "" then -+ internalState.strCrumb = string.match(body, globals.strRegExpCrumbLiveLight) -+ end -+ if internalState.strUserId == "" then -+ internalState.strUserId = string.match(body, globals.strRegExpUserLiveLight) -+ end -+ end -+ - -- Get the total number of messages - -- - if nTotMsgs == 0 then -@@ -2048,8 +2229,14 @@ function stat(pstate) - -- Check to see that we completed successfully. If not, return a network - -- error. This is the safest way to let the email client now that there is - -- a problem but that it shouldn't drop the list of known uidls. -- if (nMsgs < nTotMsgs) then -- return POPSERVER_ERR_NETWORK -+ if (nMsgs < nTotMsgs and nMsgs > 0) then -+ log.error_print("The plugin needs updating. Expecting to find: " .. nTotMsgs .. -+ " and processed " .. nMsgs) -+ return POPSERVER_ERR_OK -+ elseif (nMsgs < nTotMsgs and nMsgs == 0) then -+ log.error_print("The plugin needs updating. Expecting to find: " .. nTotMsgs .. -+ " but wasn't able to process any.") -+ return POPSERVER_ERR_NETWORK - end - - -- Return that we succeeded -@@ -2057,6 +2244,34 @@ function stat(pstate) - return POPSERVER_ERR_OK - end - -+function processMessage(uidl, size, nMsgs, pstate) -+ log.dbg("Processed STAT - Msg: " .. nMsgs .. ", UIDL: " .. uidl .. ", Size: " .. size) -+ set_popstate_nummesg(pstate, nMsgs) -+ set_mailmessage_size(pstate, nMsgs, size) -+ set_mailmessage_uidl(pstate, nMsgs, uidl) -+end -+ -+function parseSize(size) -+ -- Convert the size from it's string (4KB or 2MB) to bytes -+ -- First figure out the unit (KB or just B) -+ -- -+ local kbUnit = string.match(size, "([Kk])") -+ size = string.match(size, "([%d%.,]+)%s*[KkMm]") -- cdmackie 2008-07-02: fix for space -+ if (size ~= nil) then -+ size = string.gsub(size, ",", ".") -+ end -+ if (size ~= nil and tonumber(size) ~= nil) then -+ if not kbUnit then -+ size = math.max(tonumber(size), 0) * 1024 * 1024 -+ else -+ size = math.max(tonumber(size), 0) * 1024 -+ end -+ else -+ size = 1024 -+ end -+ return size -+end -+ - -- Fill msg uidl field - -- - function uidl(pstate,msg) diff --git a/mail/freepops/patches/patch-ai b/mail/freepops/patches/patch-ai deleted file mode 100644 index f8c165b5be0..00000000000 --- a/mail/freepops/patches/patch-ai +++ /dev/null @@ -1,526 +0,0 @@ -$NetBSD: patch-ai,v 1.1 2008/10/23 04:40:55 schmonz Exp $ - ---- src/lua/yahoo.lua.orig 2008-10-23 00:05:23.000000000 -0400 -+++ src/lua/yahoo.lua -@@ -14,7 +14,7 @@ - local _DEBUG = false - local DBG_LEN = nil -- 500 - --PLUGIN_VERSION = "0.2.1" -+PLUGIN_VERSION = "0.2.1g" - PLUGIN_NAME = "yahoo.com" - PLUGIN_REQUIRE_VERSION = "0.2.0" - PLUGIN_LICENSE = "GNU/GPL" -@@ -27,6 +27,7 @@ PLUGIN_AUTHORS_CONTACTS = - PLUGIN_DOMAINS = {"@yahoo.com", "@yahoo.ie", "@yahoo.it", "@yahoo.ca", "@rocketmail.com", "@yahoo.com.ar", - "@yahoo.co.in", "@yahoo.co.id", "@yahoo.com.tw", "@yahoo.co.uk", "@yahoo.com.cn", - "@yahoo.es", "@yahoo.de", "@talk21.com", "@btinternet.com", "@yahoo.com.au", "@yahoo.co.nz", -+ "@ymail.com", "@yahoo.in" - } - - PLUGIN_PARAMETERS = { -@@ -87,6 +88,18 @@ pulling messages. Set the value to 1.]] - Parameter is used to force the plugin to only download a maximum number of messages. ]] - } - }, -+ {name = "keepmsgstatus", description = { -+ en = [[ -+Parameter is used to maintain the status of the message in the state it was before being pulling. If the value is 1, the behavior is turned on -+and will override the markunread flag. ]] -+ } -+ }, -+ {name = "domain", description = { -+ en = [[ -+Parameter is used to override the domain in the email address. This is used so that users don't -+need to add a mapping to config.lua for a hosted hotmail account. ]] -+ } -+ }, - } - - PLUGIN_DESCRIPTIONS = { -@@ -155,20 +168,28 @@ local globals = { - -- Pattern to determine if we have no messages. If this is found, we have messages. - -- - strMsgListNoMsgPat = "()", -+ -+ -- Pattern to determine if we have no messages with 'mc'. If found, there is no messages. -+ -- -+ strMsgListNoMsgPatMC = '(modulecontainer filled nomessages)', - - -- Used by Stat to pull out the message ID and the size - -- - strMsgLineLitPattern = ".*[.*]{div}[.*]{h2}.*
.*[.*]{/h2}[.*]{/div}.*.*.*.*.*.*", - strMsgLineAbsPattern = "O[O]{O}[O]{O}OO[O]{O}[O]{O}OOOOXO", -- -+ -+ strMCUnreadPattern = '[^<]+]+>') -+ if (str2 ~= nil) then -+ str2 = string.gsub(str2, "./", "") -+ log.dbg("Found the link to get by interstitutial ad.") -+ url = str .. str2 -+ else -+ log.dbg("Did not find the link to get by interstitutial ad. Try one that worked at some point.") -+ log.dbg("Page Body: " .. body) -+ url = str .. "mail_act.php?mpref=2" -- from skip() in http://us.i1.yimg.com/us.yimg.com/lib/tb7/mail_interstitial/mail_20080612.js -+ end -+ log.dbg( "interstitial get: url=" .. url ) -+ body, err = browser:get_uri(url) -+ log.dbg( "interstitial response: err=" .. tostr(err), dbg_limit(body) ) -+ url = browser:whathaveweread() -+ log.dbg("browser:whathaveweread()=" .. url) -+ end -+ - -- Check for NewGUI and Try Beta - local bNewGui = false -- local url = browser:whathaveweread() -- log.dbg("browser:whathaveweread()=" .. url) - str = string.match(url, '/dc/try_mail') - if (str == nil) then - -- it's not a "try" page. Check if its the new gui. -@@ -964,9 +1004,8 @@ function downloadYahooMsg(pstate, msg, n - -- Get the header - -- - if internalState.bNewGUI then -- local msgid = internalState.msgids[uidl] -- uidl = msgid -- headers = getMsgHdr(pstate, uidl) -+ msgid = internalState.msgids[uidl] -+ headers = getMsgHdr(pstate, msgid) - elseif (internalState.classicType == 'mc') then - msgid = internalState.msgids[uidl] - hdrUrl = string.format(globals.strCmdAttach, internalState.strFileServer, -@@ -1038,6 +1077,22 @@ function downloadYahooMsg(pstate, msg, n - if string.sub(headers,1,5) == "From " then - headers = string.gsub(headers, "From .-\n", "", 1); - end -+ -+ -- Add custom headers -+ -- -+ local readStatus = "read" -+ if (internalState.unreadMsgs[uidl] == 1) then -+ readStatus = "unread" -+ end -+ local crlf -+ if (internalState.bNewGUI) then -+ crlf = "\n" -+ headers = string.gsub(headers, "\n+$", "") -+ else -+ crlf = "\r\n" -+ headers = string.gsub(headers, "\r\n\r\n$", "") -+ end -+ headers = headers .. crlf .. "X-FREEPOPS-READ-STATUS: " .. readStatus .. crlf .. crlf - - -- Remove "Content-Transfer-Encoding" line from the header. - -- -@@ -1063,7 +1118,7 @@ function downloadYahooMsg(pstate, msg, n - if nLines == 0 then - cbInfo.strText = "" - else -- getMsgBody(pstate, uidl, size, cbInfo) -+ getMsgBody(pstate, msgid, size, cbInfo) - end - mimer.pipe_msg( - headers, -@@ -1215,7 +1270,9 @@ function downloadYahooMsg(pstate, msg, n - - -- Do we need to mark the message as unread? - -- -- if internalState.bNewGUI and internalState.bMarkMsgAsUnread == true then -+ if (internalState.bKeepMsgStatus == true) then -+ -- no op -+ elseif internalState.bNewGUI and internalState.bMarkMsgAsUnread == true then - log.dbg("Marking as message: " .. uidl .. " as unread"); - markMsgUnread(uidl) - elseif internalState.bNewGUI == false and internalState.classicType ~= 'mc' then -@@ -1420,7 +1477,7 @@ function getSTATList(pstate) - local browser = internalState.browser - local url = string.format(globals.strSoapCmd, internalState.strMailServer, - internalState.strWebSrvUrl, "ListMessages", internalState.strCrumb) -- local nMaxMsgs = 999 -+ local nMaxMsgs = 9999 - if internalState.statLimit ~= nil then - nMaxMsgs = internalState.statLimit - end -@@ -1451,7 +1508,7 @@ function getSTATList(pstate) - - -- Parse the message id's and sizes - -- -- if (ipairs == nil) then -+ if (ent == nil) then - internalState.bStatDone = true - return POPSERVER_ERR_OK - end -@@ -1472,6 +1529,16 @@ function getSTATList(pstate) - break - end - end -+ -+ local flagElem = elem[1] -+ if (flagElem["tag"] == "flags") then -+ attrs = flagElem["attr"] -+ local readAttr = attrs["isRead"] -+ if (readAttr == "0") then -+ log.dbg("Message: " .. uidl .. " is unread.") -+ internalState.unreadMsgs[uidl] = 1 -+ end -+ end - - -- Save the information - -- -@@ -1525,6 +1592,8 @@ function getMsgHdr(pstate, uidl) - end - - function getMsgBody(pstate, uidl, size, cbInfo) -+ log.dbg("YahooNew getMsgBody - Entering") -+ - local browser = internalState.browser - local url = string.format(globals.strSoapCmd, internalState.strMailServer, - internalState.strWebSrvUrl, "GetMessage", internalState.strCrumb) -@@ -1540,50 +1609,70 @@ function getMsgBody(pstate, uidl, size, - - -- Get the parts - -- -- local part = nil -- local major = nil -+ -+-- log.dbg("YahooNew getMsgBody ent[3]=",tostr(ent[3])) -+ - for i, elem in ipairs (ent[3]) do - if (type(elem) == "table" and elem["tag"] == "part") then -- part = elem - local attrs = elem["attr"] - local partId = attrs["partId"] - local type = attrs["type"] - local subtype = attrs["subtype"] -+ local textElem = elem[1] -+ -+ local idPlain = nil -+ local idHtml = nil -+ - -- log.dbg("YahooNew getMsgBody partId="..tostr(partId).. - -- ", type="..tostr(type)..", subtype="..tostr(subtype).. -+-- ", textElem="..tostr(textElem).. - -- ", attrs=",tostr(attrs)) -- -- partId=1 is usually the main text (1.1) and html (1.2), -- -- which is handled above and therefore not included in attachments. -- -- don't assume any other plain or html is the main text -- if (subtype == "plain") then -- local textElem = elem[1] -+ -+ -- The main body plain-text and html are handled by the first -+ -- two tests and should not be included in attachments. -+ -- multipart/alternative results in two parts: text (1), html (2) -+ -- if there are more parts (e.g. attachments), the multi/alt body -+ -- is usually within the first part, so: text (1.1) and html (1.2) -+ -- Don't assume any other plain or html is part of the main body -+ -+ if (cbInfo.strText == nil) and -+ textElem and textElem["tag"] == "text" and -+ (subtype == "plain" or -+ (type == "text" and subtype == "")) then -+ idPlain = partId -+ log.dbg("YahooNew getMsgBody: adding plain text body = "..tostr(idPlain)) - local text = textElem[1] - if (text == nil) then - text = "" - end - text = text .. "\n" - cbInfo.strText = getMsgCallBack(cbInfo, text) -- -- remove major part from attachments -- major = string.match(partId,"(.-)%.") -- major = major or partId -- cbInfo.attachments[major] = nil -- elseif (subtype == "html") then -- local textElem = elem[1] -+ -- remove part from attachments -+ cbInfo.attachments[idPlain] = nil -+ -+ elseif (cbInfo.strHtml == nil) and -+ textElem and textElem["tag"] == "text" and -+ subtype == "html" then -+ idHtml = partId -+ log.dbg("YahooNew getMsgBody: adding html body = "..tostr(idHtml)) - local text = textElem[1] - text = string.gsub(text, "&", "&") - -- text = string.gsub(text, "(]+>) ", "%1\r\n") - text = text .. "\n" - cbInfo.strHtml = getMsgCallBack(cbInfo, text) -- -- remove major part from attachments -- major = string.match(partId,"(.-)%.") -- major = major or partId -- cbInfo.attachments[major] = nil -+ -- remove part from attachments -+ cbInfo.attachments[idHtml] = nil -+ - elseif (partId == "HEADER" or partId == "TEXT") then -+ log.dbg("YahooNew getMsgBody: partId ignored: "..tostr(partId)) - -- no-op -+ - else - -- Only add to attachments once, by partId -- -- We want only whole parts, not subparts (so no ".") -- if (string.match(partId,"%.") == nil) then -+ -- We only want the leaves, not the multipart groupings -+ if (type ~= "multipart") and -+ (partId ~= idPlain) and (partId ~= idHtml) then -+ log.dbg("YahooNew getMsgBody: adding an attachment = "..tostr(partId)) - local file = attrs["dispParams"] - local contentId = attrs["contentId"] - if (file ~= nil) then -@@ -1592,15 +1681,13 @@ function getMsgBody(pstate, uidl, size, - url = string.format(globals.strCmdAttach, internalState.strMailServer, - internalState.strMBox, escUidl, partId, internalState.strMailServer) - cbInfo.attachments[partId] = getRealAttachmentUrl(url) -- -- cbInfo.attachments[file] = getRealAttachmentUrl(url) -- -- table.insert(cbInfo.attachments, cbInfo.attachments[file]) - -- an empty contentId is not a valid contentId - if ((contentId ~= nil) and (contentId ~= "")) then - contentId = string.sub(contentId, 2, -2) - cbInfo.inlineids[partId] = contentId -- -- cbInfo.inlineids[file] = contentId -- -- table.insert(cbInfo.inlineids, table.getn(cbInfo.inlineids) + 1, contentId) - end -+ else -+ log.dbg("YahooNew getMsgBody: nil dispParams -- attachment NOT ADDED.") - end - end - end -@@ -1723,7 +1810,16 @@ function user(pstate, username) - local domain = freepops.get_domain(username) - local user = freepops.get_name(username) - -- internalState.strDomain = domain -+ -- Override the domain variable if it is set in the login parameter -+ -- -+ local val = (freepops.MODULE_ARGS or {}).domain or nil -+ if val ~= nil then -+ log.dbg("Yahoo: Using overridden domain: " .. val) -+ internalState.strDomain = val -+ else -+ internalState.strDomain = domain -+ end -+ - internalState.strUser = user - - -- Figure out the domain specific flags -@@ -1850,6 +1946,15 @@ function user(pstate, username) - internalState.statLimit = tonumber(val) - end - -+ -- If the flag keepmsgstatus=1 is set, then we won't touch the status of -+ -- messages that we pull. -+ -- -+ local val = (freepops.MODULE_ARGS or {}).keepmsgstatus or 0 -+ if val == "1" then -+ log.dbg("Yahoo: All messages pulled will have its status left alone.") -+ internalState.bKeepMsgStatus = true -+ end -+ - return POPSERVER_ERR_OK - end - -@@ -2093,8 +2198,7 @@ function stat(pstate) - local nPage = 0 - local nMsgs = 0 - local cmdUrl = string.format(strCmd, internalState.strMailServer, -- internalState.classicType, internalState.strMBox, nPage, internalState.strView, -- internalState.strView); -+ internalState.classicType, internalState.strMBox, nPage, internalState.strView); - - -- Keep a list of IDs that we've seen. With yahoo, their message list can - -- show messages that we've already seen. This, although a bit hacky, will -@@ -2121,16 +2225,18 @@ function stat(pstate) - -- Find out if there are any messages - -- - local nomesg = string.match(body, globals.strMsgListNoMsgPat) -- if (nomesg == nil) then -+ local nomesgMC = string.match(body, globals.strMsgListNoMsgPatMC) -+ if (nomesg == nil and internalState.classicType ~= "mc") then - return true, nil -+ elseif (nomesgMC ~= nil and internalState.classicType == "mc") then -+ return true, nil - end - - -- Find only the HTML containing the message list - -- - local subBody = string.match(body, globals.strMsgListHTMLPattern) - if (subBody == nil) then -- log.say("Yahoo Module needs to fix it's message list pattern matching.") -- return false, nil -+ return true, nil - end - - -- Tokenize out the message ID and size for each item in the list -@@ -2163,7 +2269,8 @@ function stat(pstate) - -- Get the message id. It's a series of a numbers followed by - -- an underscore repeated. - -- -- msgid = string.match(msgid, globals.strMsgIDPattern) or string.match(msgid, globals.strMsgIDMCPattern) -+ msgid = string.match(msgid, globals.strMsgIDPattern) or -+ string.match(msgid, globals.strMsgIDMCPattern) or string.match(msgid, globals.strMsgIDMIPattern) - local uidl = string.gsub(msgid, "_[^_]-_[^_]-_", "_000_000_", 1); - uidl = string.sub(uidl, 1, 60) - -@@ -2179,11 +2286,17 @@ function stat(pstate) - -- First figure out the unit (KB or just B) - -- - local kbUnit = string.match(size, "([Kk])") -- size = string.match(size, "([%d]+)[KkbB]") -- if not kbUnit then -- size = math.max(tonumber(size), 0) -- else -+ local mbUnit = string.match(size, "([Mm])") -+ size = string.match(size, "([%d]+)[ ]-[KkMmbB]") -+ if size == nil then -+ size = 1024 -+ end -+ if kbUnit then - size = math.max(tonumber(size), 0) * 1024 -+ elseif mbUnit then -+ size = math.max(tonumber(size), 0) * 1024 * 1024 -+ else -+ size = math.max(tonumber(size), 0) - end - - -- Save the information -@@ -2198,6 +2311,17 @@ function stat(pstate) - internalState.msgids[uidl] = msgid - end - end -+ -+ log.dbg("Looking for unread messages.") -+ for clazz, uidl in string.gfind(body, globals.strMCUnreadPattern) do -+ uidl = string.gsub(uidl, "/", "%%2F") -+ uidl = string.gsub(uidl, "_[^_]-_[^_]-_", "_000_000_", 1); -+ uidl = string.sub(uidl, 1, 60) -+ if (clazz == "msgnew") then -+ log.dbg("Message: " .. uidl .. " is unread.") -+ internalState.unreadMsgs[uidl] = 1 -+ end -+ end - - return true, nil - end -@@ -2206,7 +2330,7 @@ function stat(pstate) - -- change the command url - -- - local function funcCheckForMorePages(body) -- if internalState.statLimit ~= nil and internalState.statLimit >= nMsgs then -+ if internalState.statLimit ~= nil and internalState.statLimit <= nMsgs then - return true - end - -@@ -2218,6 +2342,12 @@ function stat(pstate) - cmdUrl = internalState.strMailServer .. nextURL - return false - else -+ nextURL = string.match(body, globals.strMsgListNextPagePatternMC) -+ if (nextURL ~= nil) then -+ cmdUrl = internalState.strMailServer .. internalState.classicType .. "/" .. nextURL -+ return false -+ end -+ - return true - end - end -- cgit v1.2.3