changeset 15795:a26ffc69f81c

Add support for registering URI handlers to the windows installer.
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 16 Mar 2007 02:10:25 +0000
parents 15ed2cc560ce
children 1dee9065e336
files pidgin/win32/nsis/langmacros.nsh pidgin/win32/nsis/pidgin-installer.nsi pidgin/win32/nsis/translations/english.nsh
diffstat 3 files changed, 46 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/win32/nsis/langmacros.nsh	Fri Mar 16 00:02:55 2007 +0000
+++ b/pidgin/win32/nsis/langmacros.nsh	Fri Mar 16 02:10:25 2007 +0000
@@ -25,7 +25,7 @@
   !include "${PIDGIN_DEFAULT_LANGFILE}"
   !undef INSERT_DEFAULT
 
-  ; GAIM Language file Version 3
+  ; Pidgin Language file Version 3
   ; String labels should match those from the default language file.
 
   ; Startup checks
@@ -77,6 +77,9 @@
   ; GTK+ Themes section
   !insertmacro PIDGIN_MACRO_LANGSTRING_INSERT GTK_NO_THEME_INSTALL_RIGHTS		${CUR_LANG}
 
+  ; URI Handler section
+  !insertmacro PIDGIN_MACRO_LANGSTRING_INSERT URI_HANDLERS_SECTION_TITLE		${CUR_LANG}
+
   ; Uninstall Section Prompts
   !insertmacro PIDGIN_MACRO_LANGSTRING_INSERT un.PIDGIN_UNINSTALL_ERROR_1		${CUR_LANG}
   !insertmacro PIDGIN_MACRO_LANGSTRING_INSERT un.PIDGIN_UNINSTALL_ERROR_2		${CUR_LANG}
--- a/pidgin/win32/nsis/pidgin-installer.nsi	Fri Mar 16 00:02:55 2007 +0000
+++ b/pidgin/win32/nsis/pidgin-installer.nsi	Fri Mar 16 02:10:25 2007 +0000
@@ -281,7 +281,7 @@
       ReadRegStr $R2 HKLM $R4 "Version"
       ReadRegStr $R3 HKLM "$R5" "UninstallString"
 
-  ; If previous version exists .. remove
+  ; If a previous version exists, remove it
   try_uninstall:
     StrCmp $R1 "" done
       ; Version key started with 0.60a3. Prior versions can't be
@@ -289,7 +289,7 @@
       StrCmp $R2 "" uninstall_problem
         ; Check if we have uninstall string..
         IfFileExists $R3 0 uninstall_problem
-          ; Have uninstall string.. go ahead and uninstall.
+          ; Have uninstall string, go ahead and uninstall.
           SetOverwrite on
           ; Need to copy uninstaller outside of the install dir
           ClearErrors
@@ -369,7 +369,7 @@
 
   have_gtk:
     StrCpy $GTK_FOLDER $R6
-    StrCmp $R1 "NONE" done ; If we have no rights.. can't re-install..
+    StrCmp $R1 "NONE" done ; If we have no rights, we can't re-install
     ; Even if we have a sufficient version of GTK+, we give user choice to re-install.
     ClearErrors
     ExecWait '"$TEMP\gtk-runtime.exe" /L=$LANGUAGE $ISSILENT'
@@ -484,7 +484,7 @@
 
     SetOutPath "$INSTDIR"
 
-    ; If we don't have install rights.. we're done
+    ; If we don't have install rights we're done
     StrCmp $R0 "NONE" done
     SetOverwrite off
 
@@ -545,6 +545,23 @@
 SectionGroupEnd
 
 ;--------------------------------
+;URI Handling
+SectionGroup /e $(URI_HANDLERS_SECTION_TITLE) SecURIHandlers
+  Section /o "aim:" SecURI_AIM
+    Push "aim"
+    Call RegisterURIHandler
+  SectionEnd
+  Section /o "msnim:" SecURI_MSNIM
+    Push "msnim"
+    Call RegisterURIHandler
+  SectionEnd
+  Section /o "ymsgr:" SecURI_YMSGR
+    Push "ymsgr"
+    Call RegisterURIHandler
+  SectionEnd
+SectionGroupEnd
+
+;--------------------------------
 ;Spell Checking
 
 SectionGroup /e $(PIDGIN_SPELLCHECK_SECTION_TITLE) SecSpellCheck
@@ -651,7 +668,7 @@
   try_hkcu:
     ReadRegStr $R0 HKCU ${PIDGIN_REG_KEY} ""
     StrCmp $R0 $INSTDIR 0 cant_uninstall
-      ; HKCU install path matches our INSTDIR.. so uninstall
+      ; HKCU install path matches our INSTDIR so uninstall
       DeleteRegKey HKCU ${PIDGIN_REG_KEY}
       DeleteRegKey HKCU "${PIDGIN_UNINSTALL_KEY}"
       Goto cont_uninstall
@@ -659,7 +676,7 @@
   try_hklm:
     ReadRegStr $R0 HKLM ${PIDGIN_REG_KEY} ""
     StrCmp $R0 $INSTDIR 0 try_hkcu
-      ; HKLM install path matches our INSTDIR.. so uninstall
+      ; HKLM install path matches our INSTDIR so uninstall
       DeleteRegKey HKLM ${PIDGIN_REG_KEY}
       DeleteRegKey HKLM "${PIDGIN_UNINSTALL_KEY}"
       DeleteRegKey HKLM "${HKLM_APP_PATHS_KEY}"
@@ -748,7 +765,7 @@
     !endif
     Delete "$INSTDIR\install.log"
 
-    ;Try to remove Pidgin install dir .. if empty
+    ;Try to remove Pidgin install dir (only if empty)
     RMDir "$INSTDIR"
 
     ; Shortcuts..
@@ -882,6 +899,19 @@
   Pop $0
 FunctionEnd
 
+
+Function RegisterURIHandler
+  Exch $R0
+  WriteRegStr HKEY_CLASSES_ROOT "$R0" "" "URL:$R0"
+  WriteRegStr HKEY_CLASSES_ROOT "$R0" "URL Protocol" ""
+  WriteRegStr HKEY_CLASSES_ROOT "$R0\DefaultIcon" "" "$INSTDIR\pidgin.exe"
+  WriteRegStr HKEY_CLASSES_ROOT "$R0\shell" "" ""
+  WriteRegStr HKEY_CLASSES_ROOT "$R0\shell\Open" "" ""
+  WriteRegStr HKEY_CLASSES_ROOT "$R0\shell\Open\command" "" "$INSTDIR\pidgin.exe --protocolhandler=%1"
+  Pop $R0
+FunctionEnd
+
+
 !macro CheckUserInstallRightsMacro UN
 Function ${UN}CheckUserInstallRights
   Push $0
@@ -1044,7 +1074,7 @@
       StrCmp $0 "" no_gtk have_gtk
 
   have_gtk:
-    ; GTK+ is already installed.. check version.
+    ; GTK+ is already installed; check version.
     ${VersionCompare} ${GTK_INSTALL_VERSION} $0 $3
     IntCmp $3 1 +1 good_version good_version
     ${VersionCompare} ${GTK_MIN_VERSION} $0 $3
@@ -1083,7 +1113,7 @@
 
   done:
   ; The top two items on the stack are what we want to return
-  Exch 4 
+  Exch 4
   Pop $0
   Exch 4
   Pop $3
--- a/pidgin/win32/nsis/translations/english.nsh	Fri Mar 16 00:02:55 2007 +0000
+++ b/pidgin/win32/nsis/translations/english.nsh	Fri Mar 16 02:10:25 2007 +0000
@@ -60,6 +60,9 @@
 ; GTK+ Themes section
 !insertmacro PIDGIN_MACRO_DEFAULT_STRING GTK_NO_THEME_INSTALL_RIGHTS		"You do not have permission to install a GTK+ theme."
 
+; URL Handler section
+!insertmacro PIDGIN_MACRO_DEFAULT_STRING URI_HANDLERS_SECTION_TITLE		"URI Handlers"
+
 ; Uninstall Section Prompts
 !insertmacro PIDGIN_MACRO_DEFAULT_STRING un.PIDGIN_UNINSTALL_ERROR_1		"The uninstaller could not find registry entries for Pidgin.$\rIt is likely that another user installed this application."
 !insertmacro PIDGIN_MACRO_DEFAULT_STRING un.PIDGIN_UNINSTALL_ERROR_2		"You do not have permission to uninstall this application."