Checking in ancient code

This commit is contained in:
Kumi 2018-06-03 15:31:49 +02:00
commit 3b22e236d3
19 changed files with 595 additions and 0 deletions

83
META-INF/manifest.mf Normal file
View file

@ -0,0 +1,83 @@
Manifest-Version: 1.0
Created-By: Signtool (signtool 1.3)
Comments: PLEASE DO NOT EDIT THIS FILE. YOU WILL BREAK IT.
Name: chrome/locale/en-US/autovcard.dtd
Digest-Algorithms: MD5 SHA1
MD5-Digest: 8uSpD+LJzjSszIGAJPsARQ==
SHA1-Digest: tuH/5ZLxvEj7MnUGmAEW0wLqkoI=
Name: chrome/locale/de-DE/autovcard.dtd
Digest-Algorithms: MD5 SHA1
MD5-Digest: nfcHPEF1RnPbHqn691dtcQ==
SHA1-Digest: AmwIerR6l6Cj/QQRztJRhIOgfHQ=
Name: chrome/content/options.xul
Digest-Algorithms: MD5 SHA1
MD5-Digest: RNJOcat//1Fk1bZ2Yy4xJQ==
SHA1-Digest: FJfmSWzTSF4wVY+Uxdp4uoEtAtg=
Name: chrome/content/autovcard.js
Digest-Algorithms: MD5 SHA1
MD5-Digest: y+tgc4CHRCG10jJj7XCpTA==
SHA1-Digest: bdr7ngeGONiEPoa8GG9FuHERN5w=
Name: chrome/content/autovcard16_delete.png
Digest-Algorithms: MD5 SHA1
MD5-Digest: T+qv3ppia/cSB6yCk1Wkpg==
SHA1-Digest: GSv3yiWraCzps3RQZEQll/nMy5Y=
Name: chrome/content/autovcard16_attach.png
Digest-Algorithms: MD5 SHA1
MD5-Digest: Bomb7Uy4jDL/HQuWfwzPvg==
SHA1-Digest: t1Yd3C0TRSF+KLaINEUzGaWqsh8=
Name: chrome/content/autovcard24_attach.png
Digest-Algorithms: MD5 SHA1
MD5-Digest: lVJNEB4tRD6sr9k0VICbRg==
SHA1-Digest: PQWWDSZGM4p/v9cCDivTxknw4nU=
Name: chrome/content/autovcard.xul
Digest-Algorithms: MD5 SHA1
MD5-Digest: bC9PLMmDNwHXIFgkeNLR9Q==
SHA1-Digest: UaMZFhCQaI4jfCIkz6huUzCVMpM=
Name: chrome/content/autovcard24-disabled.png
Digest-Algorithms: MD5 SHA1
MD5-Digest: J3HEEAzyF7aYCmZY6S55mQ==
SHA1-Digest: BBNlFk2McFpK/PyIQ3kLrpAeQ0Y=
Name: chrome/content/dialog.xul
Digest-Algorithms: MD5 SHA1
MD5-Digest: 4GSpavauFCbdkrS91684Hw==
SHA1-Digest: zWwdoBHzj0uIQI0bZFjqA1XURr4=
Name: chrome/content/autovcard24_delete.png
Digest-Algorithms: MD5 SHA1
MD5-Digest: KYj4QpvjI04j+4b/uvFs9Q==
SHA1-Digest: Ynp6lT5hawN0J6QB0nDB5j6I+1M=
Name: chrome/content/autovcard.css
Digest-Algorithms: MD5 SHA1
MD5-Digest: EPMi5MHutJP1Yc50LL6IwA==
SHA1-Digest: gGEHD+Ib6EjehgQpQtKMI8nGIws=
Name: chrome/content/autovcard16-disabled.png
Digest-Algorithms: MD5 SHA1
MD5-Digest: rk8UA+hKaYM+0k9DCDUtAQ==
SHA1-Digest: qtKw10i1fUOaRGkajHk5ZQRHa8c=
Name: install.rdf
Digest-Algorithms: MD5 SHA1
MD5-Digest: EaSH4ZrLgoe4A2CKWCh5jA==
SHA1-Digest: 23HhIt/isOLbIv3SZ+GlD5s40dk=
Name: chrome.manifest
Digest-Algorithms: MD5 SHA1
MD5-Digest: BGE83atWiPdtAZupowoq4Q==
SHA1-Digest: qDBeNo2zBa1JR7XZnUJhlkfWcQI=
Name: defaults/preferences/prefs.js
Digest-Algorithms: MD5 SHA1
MD5-Digest: L7XfiswIPPZKvRayRshw6g==
SHA1-Digest: f4kde1iPD3w1RqqSH9ktC7z4ito=

BIN
META-INF/zigbert.rsa Normal file

Binary file not shown.

86
META-INF/zigbert.sf Normal file
View file

@ -0,0 +1,86 @@
Signature-Version: 1.0
Created-By: Signtool (signtool 1.3)
Comments: PLEASE DO NOT EDIT THIS FILE. YOU WILL BREAK IT.
Digest-Algorithms: MD5 SHA1
MD5-Digest: f2XP9lsoHe04PBOvuFXL5g==
SHA1-Digest: 8RHZ0uUrxScBNJtHgI/t7stA9yA=
Name: chrome/locale/en-US/autovcard.dtd
Digest-Algorithms: MD5 SHA1
MD5-Digest: dvSC9Aq4GX7PyXhywsWVww==
SHA1-Digest: k3JeZhfpwAE/V/zTMoDKseE5e78=
Name: chrome/locale/de-DE/autovcard.dtd
Digest-Algorithms: MD5 SHA1
MD5-Digest: SN5kF2iwWJnQKT+AsEE0hg==
SHA1-Digest: m9f6DzQ2cK5x4aBhEEJGVN+OXV4=
Name: chrome/content/options.xul
Digest-Algorithms: MD5 SHA1
MD5-Digest: 2Ap9/IHYxAzfND9qn5Q+Hw==
SHA1-Digest: 9UBlBM6/3w2Hqxu8VorTL/bllFA=
Name: chrome/content/autovcard.js
Digest-Algorithms: MD5 SHA1
MD5-Digest: YOHsQQNOJ0ljcUR7OJpdVw==
SHA1-Digest: 1isfFf/REPW5URGZ1yY7aENIKZg=
Name: chrome/content/autovcard16_delete.png
Digest-Algorithms: MD5 SHA1
MD5-Digest: lgtR2KFT8dH3IdKSPCns2g==
SHA1-Digest: O/8Y1rong0eKfeSBt2gKXwjCuHg=
Name: chrome/content/autovcard16_attach.png
Digest-Algorithms: MD5 SHA1
MD5-Digest: 7s5Lz+tVR5lCpTz6HOBmMg==
SHA1-Digest: Sa8FIXwBOWdWDjDS9QHpJNCxG0k=
Name: chrome/content/autovcard24_attach.png
Digest-Algorithms: MD5 SHA1
MD5-Digest: 9yxQdAMOuavWjPtDn2KnHQ==
SHA1-Digest: mj95B7rhQl1FJK/PnIdkSoqne5o=
Name: chrome/content/autovcard.xul
Digest-Algorithms: MD5 SHA1
MD5-Digest: Gk9pplPvepXlaDCsSa7Cbg==
SHA1-Digest: SzGJH1NRwYm0W4yPZ141vroASh8=
Name: chrome/content/autovcard24-disabled.png
Digest-Algorithms: MD5 SHA1
MD5-Digest: FcfihevoqAsC3O7wobcV5w==
SHA1-Digest: KRiBED87GDuDZELz5YX5BT9w6+M=
Name: chrome/content/dialog.xul
Digest-Algorithms: MD5 SHA1
MD5-Digest: +C1gzv03kmC5Olp7dzp0rg==
SHA1-Digest: JkdHPnr95BwZhCp2Tt4b0QZADGk=
Name: chrome/content/autovcard24_delete.png
Digest-Algorithms: MD5 SHA1
MD5-Digest: 5fM4+fkMEZj4/4c1oBN3TQ==
SHA1-Digest: sXq9tVqEV6+Fmb1O0aONcySWhto=
Name: chrome/content/autovcard.css
Digest-Algorithms: MD5 SHA1
MD5-Digest: 2rUNcT7k5YRDn2nQudjtag==
SHA1-Digest: qrT1Qsjy2HV2bMZpybRVw+/kN4Q=
Name: chrome/content/autovcard16-disabled.png
Digest-Algorithms: MD5 SHA1
MD5-Digest: pWHD5rIUkNAvy4y4cETuAw==
SHA1-Digest: Y2iixVRiYqGQ8SfaoZXyDXLQrxo=
Name: install.rdf
Digest-Algorithms: MD5 SHA1
MD5-Digest: t0cKMmpf6y4i4q/av6X1KA==
SHA1-Digest: COIykYRtGh4066pyPybOVm2Vm1c=
Name: chrome.manifest
Digest-Algorithms: MD5 SHA1
MD5-Digest: rDHI6jN//zVwG1WVrIfvyA==
SHA1-Digest: tGli9tiMyc0TIkPFA9kvuMOHk88=
Name: defaults/preferences/prefs.js
Digest-Algorithms: MD5 SHA1
MD5-Digest: AmeSLhdYOebKMRerTpSnGg==
SHA1-Digest: r7G+SXlujfc31FbNab0PZpo8HMQ=

3
chrome.manifest Normal file
View file

@ -0,0 +1,3 @@
content autovcard chrome/content/
locale autovcard en-US chrome/locale/en-US/
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://autovcard/content/autovcard.xul

View file

@ -0,0 +1,23 @@
.autovcard_delete{
list-style-image: url("chrome://autovcard/content/autovcard24_delete.png");
}
toolbar[iconsize="small"] .autovcard_delete{
list-style-image: url("chrome://autovcard/content/autovcard16_delete.png");
}
.autovcard_attach{
list-style-image: url("chrome://autovcard/content/autovcard24_attach.png");
}
toolbar[iconsize="small"] .autovcard_attach{
list-style-image: url("chrome://autovcard/content/autovcard16_attach.png");
}
.autovcard_delete[disabled=true], .autovcard_attach[disabled=true]{
list-style-image: url("chrome://autovcard/content/autovcard24-disabled.png");
}
toolbar[iconsize="small"] .autovcard_attach[disabled=true], toolbar[iconsize="small"] .autovcard_delete[disabled=true]{
list-style-image: url("chrome://autovcard/content/autovcard16-disabled.png");
}

248
chrome/content/autovcard.js Normal file
View file

@ -0,0 +1,248 @@
const Cc = Components.classes;
const Ci = Components.interfaces;
var autovcard = {
db_connection: null,
statement: null,
to: "",
to_row_id: 100,
result: false,
manually: false,
init : function(){
this.to = "";
this.to_row_id = 100;
this.result = false;
this.manually = false;
gMsgCompose.QueryInterface(Ci.nsIMsgCompose).addMsgSendListener(this.send_listener);
this.find_to();
this.db_init();
this.check();
},
nospace : function (str) {
var re = new RegExp(/^(\s|\u00A0)+/g);
return str.replace(re, '');
},
check: function(){
this.to = this.nospace(this.to);
if (this.to == ''){return};
this.statement.params.parameter = this.to;
this.result=true;
this.statement.executeAsync({
handleResult: function(aResultSet) {
var ok = false;
for (let row = aResultSet.getNextRow(); row; row = aResultSet.getNextRow()) {
let value = row.getResultByName("email");
if (value == autovcard.to){ok = true;break};
};
if(ok){
autovcard.manually = true;
autovcard.delete_vcard();
}else{
autovcard.manually = false;
autovcard.attach_vcard();
}
},
handleError: function(aError) {
},
handleCompletion: function(aReason) {
autovcard.result=false;
}
});
},
find_to: function(){
//
// alert('tt');
for (var i = 1; i < 100; i++) {
var totype = document.getElementById('addressCol1#'+i);
if(totype == null){
this.to_row_id = 100;
this.to = '';
//this.manually = false;
this.manually = false;
//
// alert('tt');
this.delete_vcard();
break;
};
if((totype.value =='addr_to') && (document.getElementById('addressCol2#'+i).value != '')){
if((this.to_row_id == i) && (this.to == this.nospace(document.getElementById('addressCol2#'+i).value))){
break;
}
this.to_row_id = i;
this.to = document.getElementById('addressCol2#'+i).value;
this.check();
break;
}
}
},
delete_vcard : function(){
if(this.manually){
document.getElementById("autovcard_button").setAttribute('label',document.getElementById("autovcard_button").getAttribute('label_attach'));
document.getElementById("autovcard_button").className =('toolbarbutton-1 autovcard_attach');
document.getElementById("autovcard_button").setAttribute('disabled','false');
}else{
document.getElementById("autovcard_button").setAttribute('disabled','true');
}
gMsgCompose.compFields.attachVCard = false;
document.getElementById("cmd_attachVCard").setAttribute('checked','false');
},
attach_vcard : function(){
document.getElementById("autovcard_button").setAttribute('label',document.getElementById("autovcard_button").getAttribute('label_delete'));
document.getElementById("autovcard_button").className =('toolbarbutton-1 autovcard_delete');
document.getElementById("autovcard_button").setAttribute('disabled','false');
gMsgCompose.compFields.attachVCard = true;
document.getElementById("cmd_attachVCard").setAttribute('checked','true');
},
totype_changed : function(e){
var id = e.target.parentNode.parentNode.id;
id = id.slice(id.lastIndexOf('#')+1);
if(e.target.value =='addr_to'){
if ((id < this.to_row_id) && (document.getElementById('addressCol2#'+id).value != '')){
this.to_row_id = id;
this.to = document.getElementById('addressCol2#'+id).value;
this.check();
}
}else{
if(id == this.to_row_id){
this.find_to();
}
}
},
to_changed : function(e){
var id = e.target.id;
id = id.slice(id.lastIndexOf('#')+1);
if(document.getElementById('addressCol1#'+id).value =='addr_to'){
if((id == this.to_row_id) && (e.target.value == '')){
this.find_to();
}else{
if((id <= this.to_row_id) && (e.target.value != '')){
this.to_row_id = id;
this.to = e.target.value;
this.check();
}
}
}
},
send_listener : {
onStopSending: function(i, s, m, r){
if(s == '0'){
autovcard.to = autovcard.nospace(autovcard.to);
var statement = autovcard.db_connection.createStatement("INSERT INTO email VALUES(:parameter)");
statement.params.parameter = autovcard.to;
try{
statement.execute();
} catch (e) {};
};
},
onSendNotPerformed: function(){},
onGetDraftFolderURI: function(){},
onProgress: function(){},
onStartSending: function(){},
onStatus: function(){}
},
db_init: function() {
var dirService = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties);
var dbFile = dirService.get("ProfD", Ci.nsIFile);
dbFile.append("autovcard.sqlite");
var dbService = Cc["@mozilla.org/storage/service;1"].
getService(Ci.mozIStorageService);
var dbConnection;
if (!dbFile.exists())
dbConnection = this.db_create(dbService, dbFile);
else {
dbConnection = dbService.openDatabase(dbFile);
}
this.db_connection = dbConnection;
this.statement = this.db_connection.createStatement("SELECT * FROM email WHERE email = :parameter UNION SELECT 'empty'");
},
db_create: function(aDBService, aDBFile) {
var dbConnection = aDBService.openDatabase(aDBFile);
dbConnection.createTable('email', "email TEXT PRIMARY KEY");
return dbConnection;
},
add_note: function(){
if(document.getElementById("cmd_attachVCard").getAttribute('checked') =='true'){
var comment;
if(this.manually){
comment = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService).getBranch("autovcard.label.options.").getCharPref("comment_manually");
}else{
comment = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService).getBranch("autovcard.label.options.").getCharPref("comment");
}
GetCurrentEditor().beginTransaction();
GetCurrentEditor().endOfDocument();
if (GetCurrentEditorType() == "textmail" || GetCurrentEditorType() == "text"){
GetCurrentEditor().insertText(comment);
}else{
GetCurrentEditor().insertHTML(comment.replace(/\n+/g,"<br>"));
}
GetCurrentEditor().endTransaction();
}
},
check_vcard: function(command,i){
if (!i){
this.find_to();
setTimeout(function(){autovcard.check_vcard(command,1);},100);
return;
};
if(this.result && i < 20){
setTimeout(function(){autovcard.check_vcard(command,i++);},100);
return;
};
if((document.getElementById("cmd_attachVCard").getAttribute('checked') =='true') && !gMsgCompose.identity.escapedVCard){
var params = {vcard:null, out:null};
window.openDialog("chrome://autovcard/content/dialog.xul", "",
"chrome, dialog, modal, resizable=yes,centerscreen", params).focus();
if (params.out == 'ok') {
gMsgCompose.identity.escapedVCard = params.vcard;
}else{
this.manually = true;
this.delete_vcard();
}
}
goDoCommand(command);
},
button_click: function(){
this.manually = true;
if(document.getElementById("cmd_attachVCard").getAttribute('checked') =='true'){
this.delete_vcard();
}else{
this.attach_vcard();
}
}
};
window.addEventListener("compose-window-init", function(){autovcard.init();}, true);
window.addEventListener("compose-send-message", function(){autovcard.add_note();}, true);

View file

@ -0,0 +1,33 @@
<?xml version="1.0"?>
<!DOCTYPE window SYSTEM "chrome://autovcard/locale/autovcard.dtd">
<?xml-stylesheet href="chrome://autovcard/content/autovcard.css" type="text/css"?>
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript" src="chrome://autovcard/content/autovcard.js"/>
<command id="cmd_sendButton" oncommand="autovcard.check_vcard('cmd_sendButton')"/>
<command id="cmd_sendNow" oncommand="autovcard.check_vcard('cmd_sendNow')"/>
<command id="cmd_sendWithCheck" oncommand="autovcard.check_vcard('cmd_sendWithCheck')"/>
<command id="cmd_sendLater" oncommand="autovcard.check_vcard('cmd_sendLater')"/>
<textbox id="addressCol2#1" onchange="autovcard.to_changed(event);"></textbox>
<menulist id="addressCol1#1"
oncommand="gContentChanged=true;awSetAutoComplete(this.id.slice(this.id.lastIndexOf('#') + 1));autovcard.totype_changed(event);">
</menulist>
<command id="cmd_attachVCard" disabled="true" />
<toolbar id="composeToolbar2">
<toolbarbutton
class="toolbarbutton-1 autovcard_delete"
id="autovcard_button"
label="&autovcard.button.delete_vcard;"
label_delete="&autovcard.button.delete_vcard;"
label_attach="&autovcard.button.attach_vcard;"
disabled="true"
oncommand="autovcard.button_click();">
</toolbarbutton>
</toolbar>
</overlay>

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 435 B

36
chrome/content/dialog.xul Normal file
View file

@ -0,0 +1,36 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<!DOCTYPE dialog SYSTEM "chrome://autovcard/locale/autovcard.dtd">
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&autovcard.dialog.windowtitle;"
buttons="accept,cancel"
ondialogaccept="return autovcard_on_ok()"
buttonlabelaccept="&autovcard.dialog.button.accept;"
buttonlabelcancel="&autovcard.dialog.button.cancel;"
>
<script type="application/javascript">
<![CDATA[
function autovcard_callback(str){
window.arguments[0].vcard = str;
window.arguments[0].out = "ok";
}
function autovcard_on_ok() {
window.openDialog("chrome://messenger/content/addressbook/abNewCardDialog.xul",
"",
"chrome,modal,resizable=no,centerscreen",
{escapedVCardStr:"begin%3Avcard%0D%0Aversion%3A2.1%0D%0Aend%3Avcard%0D%0A%0D%0A", okCallback:autovcard_callback,titleProperty:"editVCardTitle", hideABPicker:true});
if(window.arguments[0].out == "ok"){
return true;
}else{
return false;
}
}
]]>
</script>
<vbox style='margin: 1em'>
<label value="&autovcard.dialog.label;"/>
</vbox>
</dialog>

View file

@ -0,0 +1,29 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<!DOCTYPE prefwindow SYSTEM "chrome://autovcard/locale/autovcard.dtd">
<prefwindow
title="&autovcard.label.options.windowtitle;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<prefpane>
<preferences>
<preference id="pref_comment" name="autovcard.label.options.comment" type="string"/>
<preference id="pref_comment_manually" name="autovcard.label.options.comment_manually" type="string"/>
</preferences>
<vbox>
<label value="&autovcard.label.options.comment;"/>
<textbox preference="pref_comment" multiline="true" newlines="pasteintact" cols="60" rows="6"/>
<label value=" "/>
<label value="&autovcard.label.options.comment_manually;"/>
<textbox preference="pref_comment_manually" multiline="true" newlines="pasteintact" cols="60" rows="6"/>
</vbox>
</prefpane>
</prefwindow>

View file

@ -0,0 +1,9 @@
<!ENTITY autovcard.label.options.windowtitle "Auto vCard Optionen">
<!ENTITY autovcard.label.options.comment "Kommentar, wenn vCard automatisch angehängt wird">
<!ENTITY autovcard.label.options.comment_manually "Kommentar, wenn vCard manuell angehängt wird">
<!ENTITY autovcard.button.delete_vcard "vCard entfernen">
<!ENTITY autovcard.button.attach_vcard "vCard anhängen">
<!ENTITY autovcard.dialog.windowtitle "Leere vCard">
<!ENTITY autovcard.dialog.button.accept "vCard ausfüllen">
<!ENTITY autovcard.dialog.button.cancel "Ohne vCard absenden">
<!ENTITY autovcard.dialog.label "Die vCard für diese Identität ist leer.">

View file

@ -0,0 +1,9 @@
<!ENTITY autovcard.label.options.windowtitle "AutoVcard options">
<!ENTITY autovcard.label.options.comment "Comment when Vcard attached automatically">
<!ENTITY autovcard.label.options.comment_manually "Comment when Vcard attached manually">
<!ENTITY autovcard.button.delete_vcard "delete Vcard">
<!ENTITY autovcard.button.attach_vcard "attach Vcard">
<!ENTITY autovcard.dialog.windowtitle "Empty Vcard">
<!ENTITY autovcard.dialog.button.accept "fill Vcard">
<!ENTITY autovcard.dialog.button.cancel "delete Vcard">
<!ENTITY autovcard.dialog.label "Vcard for this identity is empty.">

View file

@ -0,0 +1,10 @@
pref("autovcard.label.options.comment", "
--
vCard attached automatically
");
pref("autovcard.label.options.comment_manually", "
--
vCard attached
");

26
install.rdf Normal file
View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>autovcard@klaus-uwe.me</em:id>
<em:type>2</em:type>
<em:name>Auto vCard</em:name>
<em:version>1.2</em:version>
<em:description>Automatically attach vCard</em:description>
<em:optionsURL>chrome://autovcard/content/options.xul</em:optionsURL>
<em:creator>Klaus-Uwe Mitterer</em:creator>
<em:targetApplication>
<Description>
<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
<em:minVersion>3.0</em:minVersion>
<em:maxVersion>10.*</em:maxVersion>
</Description>
</em:targetApplication>
<em:localized>
<Description>
<em:locale>de-DE</em:locale>
<em:name>Auto vCard</em:name>
<em:description>Hängt automatisch eine vCard an</em:description>
</Description>
</em:localized>
</Description>
</RDF>