Skip site navigation (1)Skip section navigation (2)
Date:      Wed,  4 May 2011 15:20:26 +0200 (CEST)
From:      Geoffroy Desvernay <dgeo@centrale-marseille.fr>
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        gecko@FreeBSD.org, dgeo@centrale-marseille.fr
Subject:   [PATCH] deskutils/lightning-thunderbird: Patch to require only one time the master password for all distant calendars
Message-ID:  <20110504132026.799861CD64@dgeo.sysadm.ec-m.fr>

next in thread | raw e-mail | index | archive | help

>Submitter-Id:	current-users
>Originator:	Geoffroy Desvernay
>Organization:	Ecole Centrale de Marseille
>Confidential:	no 
>Synopsis:	[PATCH] deskutils/lightning-thunderbird: Patch to require only one time the master password for all distant calendars
>Severity:	non-critical
>Priority:	low
>Category:	ports 
>Class:		change-request
>Release:	FreeBSD 8.2-RELEASE-p1 amd64
>Environment:
System: FreeBSD dgeo.sysadm.ec-m.fr 8.2-RELEASE-p1 FreeBSD 8.2-RELEASE-p1 #0: Fri Apr 22 01:04:23 CEST 2011
>Description:
Patch to require only one time the master password for all distant calendars

This circumvent an annoying problem in lightning-thunderbird: it opens as many dialog boxes 'Enter master password' as the number of distant calendars registered in lightning (plus one for imap/pop/news/... accounts by thunderbird)
With this patch, (that may be included upstream later, see bugzilla), I only get two (one for thunderbird and one for lightning)...
Refs: https://bugzilla.mozilla.org/show_bug.cgi?id=349641
Patch: https://bug349641.bugzilla.mozilla.org/attachment.cgi?id=528856

Added file(s):
- files/patch-calendar:base:modules:calAuthUtils.jsm

Port maintainer (gecko@FreeBSD.org) is cc'd.

Generated with FreeBSD Port Tools 0.99
>How-To-Repeat:
>Fix:

--- lightning-thunderbird-1.0_1.patch begins here ---
diff -ruN --exclude=CVS /usr/ports/deskutils/lightning-thunderbird.orig/files/patch-calendar:base:modules:calAuthUtils.jsm /usr/ports/deskutils/lightning-thunderbird/files/patch-calendar:base:modules:calAuthUtils.jsm
--- /usr/ports/deskutils/lightning-thunderbird.orig/files/patch-calendar:base:modules:calAuthUtils.jsm	1970-01-01 01:00:00.000000000 +0100
+++ /usr/ports/deskutils/lightning-thunderbird/files/patch-calendar:base:modules:calAuthUtils.jsm	2011-04-28 20:47:47.000000000 +0200
@@ -0,0 +1,73 @@
+--- calendar/base/modules/calAuthUtils.jsm
++++ calendar/base/modules/calAuthUtils.jsm
+@@ -314,42 +314,39 @@ cal.auth.Prompt.prototype = {
+      *        the caller should fall back to promptUsernameAndPassword().
+      */
+     asyncPromptAuth : function capAPA(aChannel,   // nsIChannel
+                                       aCallback,  // nsIAuthPromptCallback
+                                       aContext,   // nsISupports
+                                       aLevel,     // PRUint32
+                                       aAuthInfo   // nsIAuthInformation
+                                 ) {
+-        let hostRealm = {};
+-        hostRealm.prePath = aChannel.URI.prePath;
+-        hostRealm.realm = aAuthInfo.realm;
+-        let port = aChannel.URI.port;
+-        if (port == -1) {
+-            let handler = cal.getIOService().getProtocolHandler(aChannel.URI.scheme)
+-                                            .QueryInterface(Components.interfaces.nsIProtocolHandler);
+-            port = handler.defaultPort;
+-        }
+-        hostRealm.passwordRealm = aChannel.URI.host + ":" + port + " (" + aAuthInfo.realm + ")";
++        var self=this;
++      
++        let promptlistener={
+ 
+-        let pw = this.getPasswordInfo(hostRealm);
+-        aAuthInfo.username = pw.username;
+-        if (pw && pw.found) {
+-            aAuthInfo.password = pw.password;
+-            // We cannot call the callback directly here so call it from a timer
+-            let timerCallback = {
+-                notify: function(timer) {
+-                    aCallback.onAuthAvailable(aContext, aAuthInfo);
+-                }
+-            };
+-            let timer = Components.classes["@mozilla.org/timer;1"]
+-                        .createInstance(Components.interfaces.nsITimer);
+-            timer.initWithCallback(timerCallback,
+-                                   0,
+-                                   Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+-        } else {
+-            let prompter2 = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
+-                                      .getService(Components.interfaces.nsIPromptFactory)
+-                                      .getPrompt(null, Components.interfaces.nsIAuthPrompt2);
+-            prompter2.asyncPromptAuth(aChannel, aCallback, aContext, aLevel, aAuthInfo);
+-        }
++          onPromptStart : function() {
++            
++            res=self.promptAuth(aChannel, aLevel, aAuthInfo);
++            
++            if (res) {
++              this.onPromptAuthAvailable();
++              return true;
++            }
++              
++            this.onPromptCanceled();
++            return false;
++          },
++
++          onPromptAuthAvailable : function() {
++            aCallback.onAuthAvailable(aContext, aAuthInfo);
++          },
++
++          onPromptCanceled : function() {
++            aCallback.onAuthCancelled(aContext, true);
++          }
++        };
++
++        var asyncprompter=Components.classes["@mozilla.org/messenger/msgAsyncPrompter;1"]  
++                          .getService(Components.interfaces.nsIMsgAsyncPrompter);
++        asyncprompter.queueAsyncAuthPrompt(aChannel.URI.spec, false, promptlistener);
+     }
+ };
--- lightning-thunderbird-1.0_1.patch ends here ---




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110504132026.799861CD64>