refactoring for #17

This commit is contained in:
Alexander Willner 2011-12-16 17:49:58 +01:00
parent 0b96d5324e
commit a0010422ed

View File

@ -111,10 +111,9 @@ function openpgp_encoding_armor(messagetype, data, partindex, parttotal) {
case 0:
result += "-----BEGIN PGP MESSAGE, PART "+partindex+"/"+parttotal+"-----\r\n";
if (openpgp.config.config.show_version) {
result += "Version: "+openpgp.config.versionstring+'\r\n\r\n';
} else {
result += '\r\n';
result += "Version: "+openpgp.config.versionstring+'\r\n';
}
result += '\r\n';
result += openpgp_encoding_base64_encode(data);
result += "\r\n="+getCheckSum(data)+"\r\n";
result += "-----END PGP MESSAGE, PART "+partindex+"/"+parttotal+"-----\r\n";
@ -122,11 +121,9 @@ function openpgp_encoding_armor(messagetype, data, partindex, parttotal) {
case 1:
result += "-----BEGIN PGP MESSAGE, PART "+partindex+"-----\r\n";
if (openpgp.config.config.show_version) {
result += "Version: "+openpgp.config.versionstring+'\r\n\r\n';
} else {
result += '\r\n';
result += "Version: "+openpgp.config.versionstring+'\r\n';
}
result += '\r\n';
result += openpgp_encoding_base64_encode(data);
result += "\r\n="+getCheckSum(data)+"\r\n";
result += "-----END PGP MESSAGE, PART "+partindex+"-----\r\n";
@ -136,10 +133,9 @@ function openpgp_encoding_armor(messagetype, data, partindex, parttotal) {
result += data.text.replace(/\n-/g,"\n- -");
result += "\r\n-----BEGIN PGP SIGNATURE-----\r\n";
if (openpgp.config.config.show_version) {
result += "Version: "+openpgp.config.versionstring+'\r\n\r\n';
} else {
result += '\r\n';
result += "Version: "+openpgp.config.versionstring+'\r\n';
}
result += '\r\n';
result += openpgp_encoding_base64_encode(data.openpgp);
result += "\r\n="+getCheckSum(data.openpgp)+"\r\n";
result += "-----END PGP SIGNATURE-----\r\n";
@ -147,11 +143,9 @@ function openpgp_encoding_armor(messagetype, data, partindex, parttotal) {
case 3:
result += "-----BEGIN PGP MESSAGE-----\r\n";
if (openpgp.config.config.show_version) {
result +="Version: "+ openpgp.config.versionstring+'\r\n\r\n';
} else {
result += '\r\n';
result +="Version: "+ openpgp.config.versionstring+'\r\n';
}
result += '\r\n';
result += openpgp_encoding_base64_encode(data);
result += "\r\n="+getCheckSum(data)+"\r\n";
result += "-----END PGP MESSAGE-----\r\n";
@ -159,11 +153,9 @@ function openpgp_encoding_armor(messagetype, data, partindex, parttotal) {
case 4:
result += "-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n";
if (openpgp.config.config.show_version) {
result += "Version: "+openpgp.config.versionstring+'\r\n\r\n';
} else {
result += '\r\n';
result += "Version: "+openpgp.config.versionstring+'\r\n';
}
result += '\r\n';
result += openpgp_encoding_base64_encode(data);
result += "\r\n="+getCheckSum(data)+"\r\n";
result += "-----END PGP PUBLIC KEY BLOCK-----\r\n\r\n";
@ -171,10 +163,9 @@ function openpgp_encoding_armor(messagetype, data, partindex, parttotal) {
case 5:
result += "-----BEGIN PGP PRIVATE KEY BLOCK-----\r\n";
if (openpgp.config.config.show_version) {
result += "Version: "+openpgp.config.versionstring+'\r\n\r\n';
} else {
result += '\r\n';
result += "Version: "+openpgp.config.versionstring+'\r\n';
}
result += '\r\n';
result += openpgp_encoding_base64_encode(data);
result += "\r\n="+getCheckSum(data)+"\r\n";
result += "-----END PGP PRIVATE KEY BLOCK-----\r\n";