Changeset 2e8903
- Timestamp:
- Sep 20, 2010, 1:59:57 AM (10 years ago)
- Branches:
- ng_0.6, ng_0.8, ng_0.9
- Children:
- c4e569
- Parents:
- 5b8d00
- Location:
- chrome
- Files:
-
- 4 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
chrome/content/v_identity/vI_rdfDatasource.js
r5b8d00 r2e8903 214 214 }, 215 215 216 searchIdentityMismatch : function() { 217 vI_notificationBar.dump("## vI_rdfDatasource: searchIdentityMismatch\n"); 218 219 var relevantIDs = new Object(); 220 var mismatchIDs = []; 221 222 // search relevant Identities 223 for each (treeType in Array("email", "maillist", "newsgroup", "filter")) { 224 var enumerator = vI_rdfDatasource.getContainer(treeType).GetElements(); 225 while (enumerator && enumerator.hasMoreElements()) { 226 var resource = enumerator.getNext(); 227 resource.QueryInterface(Components.interfaces.nsIRDFResource); 228 var id = vI_rdfDatasource.__getRDFValue(resource, "id") 229 if (id) { 230 if (!relevantIDs[id]) relevantIDs[id] = 1; else relevantIDs[id] += 1; 231 } 232 } 233 } 234 235 var AccountManager = Components.classes["@mozilla.org/messenger/account-manager;1"] 236 .getService(Components.interfaces.nsIMsgAccountManager); 237 for (var id in relevantIDs) { 238 var identity = AccountManager.getIdentity(id) 239 var resource = vI_rdfDatasource.rdfService.GetResource(vI_rdfDatasource.rdfNS + vI_rdfDatasource.rdfNSIdentities + "/" + id); 240 var rdfIdentityName = vI_rdfDatasource.__getRDFValue(resource, "identityName"); 241 var rdfEmail = vI_rdfDatasource.__getRDFValue(resource, "email"); 242 var rdfFullName = vI_rdfDatasource.__getRDFValue(resource, "fullName") 243 if ( !identity || rdfIdentityName != identity.identityName && rdfEmail != identity.email) 244 mismatchIDs.push( { oldkey: id, label : rdfIdentityName, ext1: rdfEmail, ext2: rdfFullName, count: relevantIDs[id], key: "" } ) 245 } 246 if (mismatchIDs.length > 0) { 247 vI_notificationBar.dump("## vI_rdfDatasource: searchIdentityMismatch found mismatches on id(s).\n"); 248 249 window.openDialog("chrome://v_identity/content/vI_rdfAccountMismatchDialog.xul",0, 250 "chrome, dialog, modal, alwaysRaised, resizable=yes", "identity", mismatchIDs, 251 /* callback: */ vI_rdfDatasource.repairAccountMismatch).focus(); 252 return true; 253 } 254 else { 255 vI_notificationBar.dump("## vI_rdfDatasource: searchIdentityMismatch found no mismatch\n"); 256 return false; 257 } 258 }, 259 260 repairAccountMismatch : function(type, mismatchItems) { 261 vI_notificationBar.dump("## vI_rdfDatasource: repairAccountMismatch\n"); 262 var keyField = (type == "identity")?"id":"smtp" // field to change is 'id' or 'smtp' dependent on type 263 for (var i = 0; i < mismatchItems.length; i++) { 264 vI_notificationBar.dump("## vI_rdfDatasource: repairAccountMismatch change " + mismatchItems[i].oldkey + " into " + mismatchItems[i].key + ": "); 265 // search relevant Identities 266 for each (treeType in Array("email", "maillist", "newsgroup", "filter")) { 267 var enumerator = vI_rdfDatasource.getContainer(treeType).GetElements(); 268 while (enumerator && enumerator.hasMoreElements()) { 269 var resource = enumerator.getNext(); 270 resource.QueryInterface(Components.interfaces.nsIRDFResource); 271 if (vI_rdfDatasource.__getRDFValue(resource, keyField) == mismatchItems[i].oldkey) { 272 if (mismatchItems[i].key == "") vI_rdfDatasource.__unsetRDFValue(resource, keyField, mismatchItems[i].oldkey) 273 else vI_rdfDatasource.__setRDFValue(resource, keyField, mismatchItems[i].key) 274 vI_notificationBar.dump("."); 275 } 276 } 277 } 278 vI_notificationBar.dump("\n"); 279 } 280 }, 281 282 searchSmtpMismatch : function() { 283 vI_notificationBar.dump("## vI_rdfDatasource: searchSmtpMismatch\n"); 284 285 var relevantSMTPs = new Object(); 286 var mismatchSMTPs = []; 287 288 // search relevant SMTPs 289 for each (treeType in Array("email", "maillist", "newsgroup", "filter")) { 290 var enumerator = vI_rdfDatasource.getContainer(treeType).GetElements(); 291 while (enumerator && enumerator.hasMoreElements()) { 292 var resource = enumerator.getNext(); 293 resource.QueryInterface(Components.interfaces.nsIRDFResource); 294 var smtp = vI_rdfDatasource.__getRDFValue(resource, "smtp") 295 if (smtp && smtp != DEFAULT_SMTP_TAG) { 296 if (!relevantSMTPs[smtp]) relevantSMTPs[smtp] = 1; else relevantSMTPs[smtp] += 1; 297 } 298 } 299 } 300 301 var SmtpService = Components.classes["@mozilla.org/messengercompose/smtp;1"] 302 .getService(Components.interfaces.nsISmtpService); 303 for (var smtp in relevantSMTPs) { 304 var server = SmtpService.getServerByKey(smtp) 305 var resource = vI_rdfDatasource.rdfService.GetResource(vI_rdfDatasource.rdfNS + vI_rdfDatasource.rdfNSSMTPservers + "/" + smtp); 306 var rdfSMTPlabel = vI_rdfDatasource.__getRDFValue(resource, "label"); 307 var rdfHostname = vI_rdfDatasource.__getRDFValue(resource, "hostname"); 308 var rdfUsername = vI_rdfDatasource.__getRDFValue(resource, "username") 309 if (!server || rdfSMTPlabel != (server.description?server.description:server.hostname) && rdfHostname != server.hostname) 310 mismatchSMTPs.push( { oldkey: smtp, label : rdfSMTPlabel, ext1: rdfHostname, ext2: rdfUsername, count: relevantSMTPs[smtp], key: "" } ) 311 } 312 if (mismatchSMTPs.length > 0) { 313 vI_notificationBar.dump("## vI_rdfDatasource: searchSmtpMismatch found mismatches on smtp(s).\n"); 314 window.openDialog("chrome://v_identity/content/vI_rdfAccountMismatchDialog.xul",0, 315 "chrome, dialog, modal, alwaysRaised, resizable=yes", "smtp", mismatchSMTPs, 316 /* callback: */ vI_rdfDatasource.repairAccountMismatch).focus(); 317 return true; 318 } 319 else { 320 vI_notificationBar.dump("## vI_rdfDatasource: searchSmtpMismatch found no mismatch\n"); 321 return false; 322 } 323 }, 324 216 325 storeAccountInfo : function() { 217 326 vI_notificationBar.dump("## vI_rdfDatasource: storeAccounts\n"); … … 463 572 if (topic == "am-smtpChanges" || topic == "am-acceptChanges") { 464 573 vI_notificationBar.dump("## vI_rdfDatasource: account/smtp changes observed\n"); 574 if (vI_rdfDatasource.searchIdentityMismatch()) { 575 vI_notificationBar.dump("## vI_rdfDatasource: identity mismatch detected\n"); 576 } 577 if (vI_rdfDatasource.searchSmtpMismatch()) { 578 vI_notificationBar.dump("## vI_rdfDatasource: smtp mismatch detected\n"); 579 } 465 580 vI_rdfDatasource.refreshAccountInfo(); 466 581 } -
chrome/skin/classic/v_identity/v_identity.css
r5b8d00 r2e8903 11 11 -moz-appearance: textfield; 12 12 } 13 14 .mismatchLine { 15 -moz-binding: url("chrome://v_identity/content/vI_rdfAccountMismatchDialog.xml#mismatch-line"); 16 } 17 18 .mismatchMenulist { 19 -moz-binding: url("chrome://v_identity/content/vI_rdfAccountMismatchDialog.xml#mismatch-menulist"); 20 } 21 22 .mismatchMenupopup { 23 -moz-binding: url("chrome://v_identity/content/vI_rdfAccountMismatchDialog.xml#mismatch-menupopup"); 24 } 25 26 .mismatchMenuitem { 27 -moz-binding: url("chrome://v_identity/content/vI_rdfAccountMismatchDialog.xml#mismatch-menuitem"); 28 } 29 30 .identityDesc-ext1, .identityDesc-ext2, .identityDesc-count { 31 font-style: italic; 32 color: graytext; 33 } 34 13 35 .smtpServerListHbox { 14 36 -moz-binding: url("chrome://v_identity/content/v_identity.xml#smtpServerList");
Note: See TracChangeset
for help on using the changeset viewer.