0,0 → 1,104 |
Extend the ThunderBayes 1.0.1 extension (https://addons.mozilla.org/en-US/thunderbird/addon/4025) |
to move messages without send them and to have 'Spam' button directly without menu |
|
diff -ru ../orig/content/thunderbayes.js ./content/thunderbayes.js |
--- ../orig/content/thunderbayes.js 2008-10-29 22:11:55.000000000 +0100 |
+++ ./content/thunderbayes.js 2008-10-29 21:42:48.000000000 +0100 |
@@ -63,27 +63,32 @@ |
SetNextMessageAfterDelete(); |
} |
|
- var sbURL = "http://" + prefs.getProxyHost() + ":" + prefs.getProxyPort(); |
- var head = null; |
- if (this.useREST || this.prefs.isThunderBayesProxyRunning()) { |
- this.useREST = true; |
- sbURL += "/thunderbayes.train"; |
- head = "which=" + (setAsSpam ? "spam" : "ham") + "&text=" |
- } else { |
- sbURL += "/train"; |
- head = "which=" + encodeURIComponent("Train as " + (setAsSpam ? "Spam" : "Ham")) + "&file=&text="; |
- } |
- var sendMessage = this.sendMessage; |
- for (var i in messages) { |
- var callback = function(msgURI, data) { |
- try { |
- sendMessage([msgURI], sbURL, head + encodeURIComponent(data), command); |
- } catch (ex) { |
- command.error([msgURI], "Error processing message data: " + ex); |
+ if(prefs.getProxyHost()) { |
+ var sbURL = "http://" + prefs.getProxyHost() + ":" + prefs.getProxyPort(); |
+ var head = null; |
+ if (this.useREST || this.prefs.isThunderBayesProxyRunning()) { |
+ this.useREST = true; |
+ sbURL += "/thunderbayes.train"; |
+ head = "which=" + (setAsSpam ? "spam" : "ham") + "&text=" |
+ } else { |
+ sbURL += "/train"; |
+ head = "which=" + encodeURIComponent("Train as " + (setAsSpam ? "Spam" : "Ham")) + "&file=&text="; |
+ } |
+ var sendMessage = this.sendMessage; |
+ for (var i in messages) { |
+ var callback = function(msgURI, data) { |
+ try { |
+ sendMessage([msgURI], sbURL, head + encodeURIComponent(data), command); |
+ } catch (ex) { |
+ command.error([msgURI], "Error processing message data: " + ex); |
+ } |
} |
+ this.getMessageSrc(messages[i], callback, command); |
} |
- this.getMessageSrc(messages[i], callback, command); |
- } |
+ } |
+ else if(command.isMove) { |
+ this.moveMessages(messages, command.srcFolderURI, command.dstFolderURI); |
+ } |
|
this.updateSpamButton(); |
}, |
diff -ru ../orig/content/thunderbayes.xul ./content/thunderbayes.xul |
--- ../orig/content/thunderbayes.xul 2008-10-29 22:11:55.000000000 +0100 |
+++ ./content/thunderbayes.xul 2008-10-29 22:09:25.000000000 +0100 |
@@ -91,6 +91,16 @@ |
</toolbarbutton> |
</deck> |
</toolbaritem> |
+ <toolbaritem id="thunderbayes-button-spam-only"> |
+ <deck id="thunderbayes-spam-only-deck"> |
+ <toolbarbutton id="thunderbayes-spam-only-button" class="toolbarbutton-1" |
+ label="&thunderbayes.spam.label;" |
+ tooltiptext="&thunderbayes.spam.tooltip;" |
+ observes="cmd_thunderbayes_train" |
+ oncommand="ThunderBayes.onSpamCommand(true)"> |
+ </toolbarbutton> |
+ </deck> |
+ </toolbaritem> |
</toolbarpalette> |
|
<tree id="threadTree"> |
diff -ru ../orig/skin/thunderbayes.css ./skin/thunderbayes.css |
--- ../orig/skin/thunderbayes.css 2008-10-29 22:11:55.000000000 +0100 |
+++ ./skin/thunderbayes.css 2008-10-29 22:02:13.000000000 +0100 |
@@ -38,6 +38,22 @@ |
list-style-image: url("chrome://thunderbayes/skin/icons/thunderbayes_spam_small_disabled.png"); |
} |
|
+#thunderbayes-spam-only-button { |
+ list-style-image: url("chrome://thunderbayes/skin/icons/thunderbayes_spam.png"); |
+} |
+ |
+#thunderbayes-spam-only-button[disabled="true"] { |
+ list-style-image: url("chrome://thunderbayes/skin/icons/thunderbayes_spam_disabled.png"); |
+} |
+ |
+toolbar[iconsize="small"] #thunderbayes-spam-only-button { |
+ list-style-image: url("chrome://thunderbayes/skin/icons/thunderbayes_spam_small.png"); |
+} |
+ |
+toolbar[iconsize="small"] #thunderbayes-spam-only-button[disabled="true"] { |
+ list-style-image: url("chrome://thunderbayes/skin/icons/thunderbayes_spam_small_disabled.png"); |
+} |
+ |
#thunderbayes-ham-button { |
list-style-image: url("chrome://thunderbayes/skin/icons/thunderbayes_ham.png"); |
} |