summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorniko <niko>2012-06-24 22:45:07 (GMT)
committerniko <niko>2012-06-24 22:45:07 (GMT)
commita192b45158dbfb8a8dae3d1b976555ef20e46e04 (patch)
tree02fc368cf331aef58611041c1416584729c04029 /src
parent07b65e1a71a0972b6a1f4f13d522cc25b8a9fe50 (diff)
downloadsynckolab-a192b45158dbfb8a8dae3d1b976555ef20e46e04.tar.gz
fix problem with spaces in subject
Diffstat (limited to 'src')
-rw-r--r--src/chrome/content/synckolab/synckolab.js12
-rw-r--r--src/chrome/content/synckolab/tools.js23
2 files changed, 29 insertions, 6 deletions
diff --git a/src/chrome/content/synckolab/synckolab.js b/src/chrome/content/synckolab/synckolab.js
index 3b65bcf..3e92c01 100644
--- a/src/chrome/content/synckolab/synckolab.js
+++ b/src/chrome/content/synckolab/synckolab.js
@@ -719,7 +719,7 @@ com.synckolab.main.getMessage = function()
}
- if(!cur.mime2DecodedSubject || cur.mime2DecodedSubject.length < 3 || cur.mime2DecodedSubject.indexOf(" ") !== -1) {
+ if(!cur.mime2DecodedSubject || cur.mime2DecodedSubject.length < 3) {
com.synckolab.tools.logMessage("Message '" + cur.mime2DecodedSubject + "' has an invalid subject!", com.synckolab.global.LOG_INFO);
// skip current and process next nessage
skipCMessage = true;
@@ -777,12 +777,12 @@ com.synckolab.main.getMessage = function()
cur.date (PRTime) ?
*/
com.synckolab.main.gLastMessageDBHdr = cur;
- com.synckolab.tools.logMessage("checking for synckey in local db: " + cur.mime2DecodedSubject, com.synckolab.global.LOG_DEBUG);
- com.synckolab.main.gSyncFileKey = com.synckolab.main.syncMessageDb.get(cur.mime2DecodedSubject);
+ com.synckolab.tools.logMessage("checking for synckey in local db: " + com.synckolab.tools.getUidFromHeader(cur.mime2DecodedSubject), com.synckolab.global.LOG_DEBUG);
+ com.synckolab.main.gSyncKeyInfo = com.synckolab.tools.getUidFromHeader(cur.mime2DecodedSubject);
+ com.synckolab.main.gSyncFileKey = com.synckolab.main.syncMessageDb.get(com.synckolab.main.gSyncKeyInfo);
- com.synckolab.main.gSyncKeyInfo = cur.mime2DecodedSubject;
if (laterMsg) {
- com.synckolab.tools.logMessage("taking " + cur.mime2DecodedSubject + " from fist round...", com.synckolab.global.LOG_DEBUG);
+ com.synckolab.tools.logMessage("taking " + com.synckolab.main.gSyncKeyInfo + " from fist round...", com.synckolab.global.LOG_DEBUG);
// get the message content into fileContent
// parseMessageRunner is called when we got the message
@@ -798,7 +798,7 @@ com.synckolab.main.getMessage = function()
else {
if (com.synckolab.main.gSyncFileKey)
{
- com.synckolab.tools.logMessage("we have " + cur.mime2DecodedSubject + " already locally...", com.synckolab.global.LOG_DEBUG);
+ com.synckolab.tools.logMessage("we have " + com.synckolab.main.gSyncKeyInfo + " already locally...", com.synckolab.global.LOG_DEBUG);
// check if the message has changed
if (cur.messageSize === Number(com.synckolab.main.gSyncFileKey[1]) && cur.date === Number(com.synckolab.main.gSyncFileKey[2]))
{
diff --git a/src/chrome/content/synckolab/tools.js b/src/chrome/content/synckolab/tools.js
index a09c475..c3652b6 100644
--- a/src/chrome/content/synckolab/tools.js
+++ b/src/chrome/content/synckolab/tools.js
@@ -1511,4 +1511,27 @@ com.synckolab.tools.launchUrl = function(aURL) {
var messenger = Components.classes["@mozilla.org/messenger;1"].createInstance();
messenger = messenger.QueryInterface(Components.interfaces.nsIMessenger);
messenger.launchExternalURL(aURL);
+};
+
+
+com.synckolab.tools.getUidFromHeader = function (header) {
+ if(!header) {
+ return header;
+ }
+
+ var space = header.indexOf(' ');
+ if(space === -1) {
+ return header;
+ }
+
+ if(header.indexOf("iCal ") || header.indexOf("ical ")) {
+ return header.substring(5);
+ }
+
+ if(header.indexOf("vCard ") || header.indexOf("vcard ")) {
+ return header.substring(6);
+ }
+
+ // might be a mailing list - name is the header and it might contain spaces!
+ return header;
}; \ No newline at end of file