comparison pidgin/win32/nsis/pidgin-installer.nsi @ 22775:a8a2268ce925

Remove the stored installer language selection when uninstalling. Also, remove any URI handlers that are currently registered. Fixes #5671.
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 01 May 2008 03:55:48 +0000
parents dfa337b45aec
children 2565ccc4898c
comparison
equal deleted inserted replaced
22774:4fa58a0bd220 22775:a8a2268ce925
47 !insertmacro GetParent 47 !insertmacro GetParent
48 48
49 !include "WordFunc.nsh" 49 !include "WordFunc.nsh"
50 !insertmacro VersionCompare 50 !insertmacro VersionCompare
51 !insertmacro WordFind 51 !insertmacro WordFind
52 !insertmacro un.WordFind
52 53
53 ;-------------------------------- 54 ;--------------------------------
54 ;Defines 55 ;Defines
55 56
56 !define PIDGIN_NSIS_INCLUDE_PATH "." 57 !define PIDGIN_NSIS_INCLUDE_PATH "."
547 SectionEnd 548 SectionEnd
548 SectionGroupEnd 549 SectionGroupEnd
549 550
550 ;-------------------------------- 551 ;--------------------------------
551 ;URI Handling 552 ;URI Handling
553
554 !macro URI_SECTION proto
555 Section /o "${proto}:" SecURI_${proto}
556 Push "${proto}"
557 Call RegisterURIHandler
558 SectionEnd
559 !macroend
552 SectionGroup /e $(URI_HANDLERS_SECTION_TITLE) SecURIHandlers 560 SectionGroup /e $(URI_HANDLERS_SECTION_TITLE) SecURIHandlers
553 Section /o "aim:" SecURI_AIM 561 !insertmacro URI_SECTION "aim"
554 Push "aim" 562 !insertmacro URI_SECTION "msnim"
555 Call RegisterURIHandler 563 !insertmacro URI_SECTION "myim"
556 SectionEnd 564 !insertmacro URI_SECTION "ymsgr"
557 Section /o "msnim:" SecURI_MSNIM
558 Push "msnim"
559 Call RegisterURIHandler
560 SectionEnd
561 Section /o "myim:" SecURI_MYIM
562 Push "myim"
563 Call RegisterURIHandler
564 SectionEnd
565 Section /o "ymsgr:" SecURI_YMSGR
566 Push "ymsgr"
567 Call RegisterURIHandler
568 SectionEnd
569 SectionGroupEnd 565 SectionGroupEnd
570 566
571 ;-------------------------------- 567 ;--------------------------------
572 ;Spell Checking 568 ;Spell Checking
573 569
692 688
693 cont_uninstall: 689 cont_uninstall:
694 ; The WinPrefs plugin may have left this behind.. 690 ; The WinPrefs plugin may have left this behind..
695 DeleteRegValue HKCU "${STARTUP_RUN_KEY}" "Pidgin" 691 DeleteRegValue HKCU "${STARTUP_RUN_KEY}" "Pidgin"
696 DeleteRegValue HKLM "${STARTUP_RUN_KEY}" "Pidgin" 692 DeleteRegValue HKLM "${STARTUP_RUN_KEY}" "Pidgin"
697 ; Remove Language preference info (TODO: check if NSIS removes this) 693 ; Remove Language preference info
694 DeleteRegValue HKCU "${PIDGIN_REG_KEY}" "Installer Language"
695
696 ; Remove any URI handlers
697 ; I can't think of an easy way to maintain a list in a single place
698 Push "aim"
699 Call un.UnregisterURIHandler
700 Push "msnim"
701 Call un.UnregisterURIHandler
702 Push "myim"
703 Call un.UnregisterURIHandler
704 Push "ymsgr"
705 Call un.UnregisterURIHandler
698 706
699 Delete "$INSTDIR\ca-certs\Equifax_Secure_CA.pem" 707 Delete "$INSTDIR\ca-certs\Equifax_Secure_CA.pem"
700 Delete "$INSTDIR\ca-certs\GTE_CyberTrust_Global_Root.pem" 708 Delete "$INSTDIR\ca-certs\GTE_CyberTrust_Global_Root.pem"
701 Delete "$INSTDIR\ca-certs\Microsoft_Secure_Server_Authority.pem" 709 Delete "$INSTDIR\ca-certs\Microsoft_Secure_Server_Authority.pem"
702 Delete "$INSTDIR\ca-certs\StartCom_Free_SSL_CA.pem" 710 Delete "$INSTDIR\ca-certs\StartCom_Free_SSL_CA.pem"
901 909
902 ClearErrors 910 ClearErrors
903 ReadRegStr $R3 HKCR "$R2" "" 911 ReadRegStr $R3 HKCR "$R2" ""
904 IfErrors default_on ;there is no current handler 912 IfErrors default_on ;there is no current handler
905 913
906 ; Check if Pidgin is the current handler 914 Push $R2
907 ClearErrors 915 Call CheckIfPidginIsCurrentURIHandler
908 ReadRegStr $R3 HKCR "$R2\shell\Open\command" "" 916 Pop $R3
909 IfErrors end_loop 917
910 ${WordFind} "$R3" "pidgin.exe" "E+1{" $R3 918 ; If Pidgin isn't the current handler, we don't steal it automatically
911 IfErrors end_loop default_on 919 IntCmp $R3 0 end_loop
912 920
913 ;We default the URI handler checkbox on 921 ;We default the URI handler checkbox on
914 default_on: 922 default_on:
915 IntOp $R1 $R1 | ${SF_SELECTED} ; Select 923 IntOp $R1 $R1 | ${SF_SELECTED} ; Select
916 SectionSetFlags $R0 $R1 924 SectionSetFlags $R0 $R1
924 Pop $R2 932 Pop $R2
925 Pop $R1 933 Pop $R1
926 Pop $R0 934 Pop $R0
927 FunctionEnd ;SelectURIHandlerSections 935 FunctionEnd ;SelectURIHandlerSections
928 936
937 ; Check if Pidgin is the current handler
938 ; Returns a boolean on the stack
939 !macro CheckIfPidginIsCurrentURIHandlerMacro UN
940 Function ${UN}CheckIfPidginIsCurrentURIHandler
941 Exch $R0
942 ClearErrors
943
944 ReadRegStr $R0 HKCR "$R0\shell\Open\command" ""
945 IfErrors 0 +3
946 IntOp $R0 0 + 0
947 Goto done
948
949 !ifdef __UNINSTALL__
950 ${un.WordFind} "$R0" "pidgin.exe" "E+1{" $R0
951 !else
952 ${WordFind} "$R0" "pidgin.exe" "E+1{" $R0
953 !endif
954 IntOp $R0 0 + 1
955 IfErrors 0 +2
956 IntOp $R0 0 + 0
957
958 done:
959 Exch $R0
960 FunctionEnd
961 !macroend
962 !insertmacro CheckIfPidginIsCurrentURIHandlerMacro ""
963 !insertmacro CheckIfPidginIsCurrentURIHandlerMacro "un."
964
965 ; If Pidgin is the current URI handler for the specified protocol, remove it.
966 Function un.UnregisterURIHandler
967 Exch $R0
968 Push $R1
969
970 Push $R0
971 Call un.CheckIfPidginIsCurrentURIHandler
972 Pop $R1
973
974 ; If Pidgin isn't the current handler, leave it as-is
975 IntCmp $R1 0 done
976
977 ;Unregister the URI handler
978 DetailPrint "Unregistering $R0 URI Handler"
979 DeleteRegKey HKCR "$R0"
980
981 done:
982 Pop $R1
983 Pop $R0
984 FunctionEnd
929 985
930 Function RegisterURIHandler 986 Function RegisterURIHandler
931 Exch $R0 987 Exch $R0
988 DetailPrint "Registering $R0 URI Handler"
932 DeleteRegKey HKCR "$R0" 989 DeleteRegKey HKCR "$R0"
933 WriteRegStr HKCR "$R0" "" "URL:$R0" 990 WriteRegStr HKCR "$R0" "" "URL:$R0"
934 WriteRegStr HKCR "$R0" "URL Protocol" "" 991 WriteRegStr HKCR "$R0" "URL Protocol" ""
935 WriteRegStr HKCR "$R0\DefaultIcon" "" "$INSTDIR\pidgin.exe" 992 WriteRegStr HKCR "$R0\DefaultIcon" "" "$INSTDIR\pidgin.exe"
936 WriteRegStr HKCR "$R0\shell" "" "" 993 WriteRegStr HKCR "$R0\shell" "" ""
1196 Call RunCheck 1253 Call RunCheck
1197 StrCpy $name "Pidgin ${PIDGIN_VERSION}" 1254 StrCpy $name "Pidgin ${PIDGIN_VERSION}"
1198 StrCpy $SPELLCHECK_SEL "" 1255 StrCpy $SPELLCHECK_SEL ""
1199 1256
1200 ;Try to copy the old Gaim installer Lang Reg. key 1257 ;Try to copy the old Gaim installer Lang Reg. key
1258 ;(remove it after we're done to prevent this being done more than once)
1201 ClearErrors 1259 ClearErrors
1202 ReadRegStr $R0 HKCU "${PIDGIN_REG_KEY}" "Installer Language" 1260 ReadRegStr $R0 HKCU "${PIDGIN_REG_KEY}" "Installer Language"
1203 IfErrors 0 +5 1261 IfErrors 0 +5
1204 ClearErrors 1262 ClearErrors
1205 ReadRegStr $R0 HKCU "SOFTWARE\gaim" "Installer Language" 1263 ReadRegStr $R0 HKCU "${OLD_GAIM_REG_KEY}" "Installer Language"
1206 IfErrors +2 1264 IfErrors +3
1265 DeleteRegValue HKCU "${OLD_GAIM_REG_KEY}" "Installer Language"
1207 WriteRegStr HKCU "${PIDGIN_REG_KEY}" "Installer Language" "$R0" 1266 WriteRegStr HKCU "${PIDGIN_REG_KEY}" "Installer Language" "$R0"
1208 1267
1209 !insertmacro SetSectionFlag ${SecSpellCheck} ${SF_RO} 1268 !insertmacro SetSectionFlag ${SecSpellCheck} ${SF_RO}
1210 !insertmacro UnselectSection ${SecSpellCheck} 1269 !insertmacro UnselectSection ${SecSpellCheck}
1211 1270
1319 FunctionEnd 1378 FunctionEnd
1320 1379
1321 Function un.onInit 1380 Function un.onInit
1322 Call un.RunCheck 1381 Call un.RunCheck
1323 StrCpy $name "Pidgin ${PIDGIN_VERSION}" 1382 StrCpy $name "Pidgin ${PIDGIN_VERSION}"
1383 ;LogSet on
1324 1384
1325 ; Get stored language preference 1385 ; Get stored language preference
1326 !insertmacro MUI_UNGETLANGUAGE 1386 !insertmacro MUI_UNGETLANGUAGE
1327 1387
1328 FunctionEnd 1388 FunctionEnd