1 ; Installer script for win32 Pidgin
2 ; Original Author: Herman Bloggs <hermanator12002@yahoo.com>
3 ; Updated By: Daniel Atallah <daniel_atallah@yahoo.com>
5 ; NOTE: this .NSI script is intended for NSIS 2.27+
8 ;--------------------------------
15 ;--------------------------------
18 ;The name var is set in .onInit
21 !ifdef OFFLINE_INSTALLER
22 OutFile "pidgin-${PIDGIN_VERSION}-offline.exe"
24 OutFile "pidgin-${PIDGIN_VERSION}.exe"
27 SetCompressor
/SOLID lzma
29 ShowUninstDetails show
31 RequestExecutionLevel highest
33 ; $name and $INSTDIR are set in .onInit function..
36 !include "Sections.nsh"
37 !include "LogicLib.nsh"
38 !include "Memento.nsh"
40 !include "FileFunc.nsh"
41 !insertmacro GetParameters
42 !insertmacro GetOptions
43 !insertmacro GetParent
45 !include "WordFunc.nsh"
46 !insertmacro VersionCompare
48 !insertmacro un
.WordFind
50 !include "TextFunc.nsh"
52 ;--------------------------------
55 !define PIDGIN_NSIS_INCLUDE_PATH
"."
57 ; Remove these and the stuff that uses them at some point
58 !define OLD_GAIM_REG_KEY
"SOFTWARE\gaim"
59 !define OLD_GAIM_UNINSTALL_KEY
"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Gaim"
60 !define OLD_GAIM_UNINST_EXE
"gaim-uninst.exe"
62 !define PIDGIN_REG_KEY
"SOFTWARE\pidgin"
63 !define PIDGIN_UNINSTALL_KEY
"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Pidgin"
65 !define HKLM_APP_PATHS_KEY
"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\pidgin.exe"
66 !define STARTUP_RUN_KEY
"SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
67 !define PIDGIN_UNINST_EXE
"pidgin-uninst.exe"
69 !define GTK_MIN_VERSION
"2.14.0"
71 !define DOWNLOADER_URL
"https://pidgin.im/win32/download_redir.php?version=${PIDGIN_VERSION}"
73 !define MEMENTO_REGISTRY_ROOT
HKLM
74 !define MEMENTO_REGISTRY_KEY
"${PIDGIN_UNINSTALL_KEY}"
76 ;--------------------------------
78 VIProductVersion
"${PIDGIN_PRODUCT_VERSION}"
79 VIAddVersionKey
"ProductName" "Pidgin"
80 VIAddVersionKey
"FileVersion" "${PIDGIN_VERSION}"
81 VIAddVersionKey
"ProductVersion" "${PIDGIN_VERSION}"
82 VIAddVersionKey
"LegalCopyright" ""
83 !ifdef OFFLINE_INSTALLER
84 VIAddVersionKey
"FileDescription" "Pidgin Installer (Offline)"
86 VIAddVersionKey
"FileDescription" "Pidgin Installer"
89 ;--------------------------------
90 ;Reserve files used in .onInit
92 ReserveFile
"${NSISDIR}\Plugins\System.dll"
93 ReserveFile
"${NSISDIR}\Plugins\UserInfo.dll"
94 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
95 !insertmacro MUI_RESERVEFILE_LANGDLL
97 ;--------------------------------
98 ;Modern UI Configuration
100 !define MUI_ICON
".\pixmaps\pidgin-install.ico"
101 !define MUI_UNICON
".\pixmaps\pidgin-install.ico"
102 !define MUI_WELCOMEFINISHPAGE_BITMAP
".\pixmaps\pidgin-intro.bmp"
103 !define MUI_HEADERIMAGE
104 !define MUI_HEADERIMAGE_BITMAP
".\pixmaps\pidgin-header.bmp"
106 ; Alter License section
107 !define MUI_LICENSEPAGE_BUTTON
$(PIDGINLICENSEBUTTON
)
108 !define MUI_LICENSEPAGE_TEXT_BOTTOM
$(PIDGINLICENSEBOTTOMTEXT
)
110 !define MUI_LANGDLL_REGISTRY_ROOT
"HKCU"
111 !define MUI_LANGDLL_REGISTRY_KEY
${PIDGIN_REG_KEY}
112 !define MUI_LANGDLL_REGISTRY_VALUENAME
"Installer Language"
114 !define MUI_COMPONENTSPAGE_SMALLDESC
115 !define MUI_ABORTWARNING
118 !define MUI_FINISHPAGE_NOAUTOCLOSE
119 ;!define MUI_FINISHPAGE_RUN "$INSTDIR\pidgin.exe"
120 ;!define MUI_FINISHPAGE_RUN_NOTCHECKED
121 !define MUI_FINISHPAGE_LINK
$(PIDGINFINISHVISITWEBSITE
)
122 !define MUI_FINISHPAGE_LINK_LOCATION
"https://pidgin.im"
124 ;--------------------------------
127 !define MUI_PAGE_CUSTOMFUNCTION_PRE preWelcomePage
128 !insertmacro MUI_PAGE_WELCOME
129 !insertmacro MUI_PAGE_LICENSE
"../../../COPYING"
130 !insertmacro MUI_PAGE_COMPONENTS
132 ; Pidgin install dir page
133 !insertmacro MUI_PAGE_DIRECTORY
135 !insertmacro MUI_PAGE_INSTFILES
136 !insertmacro MUI_PAGE_FINISH
138 !insertmacro MUI_UNPAGE_WELCOME
139 !insertmacro MUI_UNPAGE_CONFIRM
140 !insertmacro MUI_UNPAGE_INSTFILES
141 !insertmacro MUI_UNPAGE_FINISH
143 ;--------------------------------
146 !include "${PIDGIN_NSIS_INCLUDE_PATH}\langmacros.nsh"
148 ;--------------------------------
150 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
151 ;; Start Install Sections ;;
152 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
154 ;--------------------------------
155 ;Uninstall any old version of Pidgin (or Gaim)
157 Section -SecUninstallOldPidgin
158 ; Check install rights..
159 Call CheckUserInstallRights
162 ;First try to uninstall Pidgin
163 StrCpy $R4 ${PIDGIN_REG_KEY}
164 StrCpy $R5 ${PIDGIN_UNINSTALL_KEY}
165 StrCpy $R6 ${PIDGIN_UNINST_EXE}
169 ;If pidgin is currently set to run on startup,
170 ; save the section of the Registry where the setting is before uninstalling,
171 ; so we can put it back after installing the new version
173 ReadRegStr $STARTUP_RUN_KEY HKCU "${STARTUP_RUN_KEY}" $R7
175 StrCpy $STARTUP_RUN_KEY "HKCU"
178 ReadRegStr $STARTUP_RUN_KEY HKLM "${STARTUP_RUN_KEY}" $R7
180 StrCpy $STARTUP_RUN_KEY "HKLM"
182 StrCmp $R0 "HKLM" compare_hklm
183 StrCmp $R0 "HKCU" compare_hkcu done
186 ReadRegStr $R1 HKCU $R4 ""
187 ReadRegStr $R2 HKCU $R4 "Version"
188 ReadRegStr $R3 HKCU "$R5" "UninstallString"
192 ReadRegStr $R1 HKLM $R4 ""
193 ReadRegStr $R2 HKLM $R4 "Version"
194 ReadRegStr $R3 HKLM "$R5" "UninstallString"
196 ; If a previous version exists, remove it
198 StrCmp $R1 "" no_version_found
199 ; Version key started with 0.60a3. Prior versions can't be
200 ; automatically uninstalled.
201 StrCmp $R2 "" uninstall_problem
202 ; Check if we have uninstall string..
203 IfFileExists $R3 0 uninstall_problem
204 ; Have uninstall string, go ahead and uninstall.
206 ; Need to copy uninstaller outside of the install dir
208 CopyFiles /SILENT
$R3 "$TEMP\$R6"
210 IfErrors uninstall_problem
211 ; Ready to uninstall..
213 ExecWait '"$TEMP\$R6" /S /UPGRADE=1 _?=$R1'
220 Goto uninstall_problem
223 ;We've already tried to fallback to an old gaim instance
224 StrCmp $R7 "Gaim" done
225 ; If we couldn't uninstall Pidgin, try to uninstall Gaim
226 StrCpy $STARTUP_RUN_KEY "NONE"
227 StrCpy $R4 ${OLD_GAIM_REG_KEY}
228 StrCpy $R5 ${OLD_GAIM_UNINSTALL_KEY}
229 StrCpy $R6 ${OLD_GAIM_UNINST_EXE}
231 Goto start_comparison
234 ; We can't uninstall. Either the user must manually uninstall or we ignore and reinstall over it.
235 MessageBox MB_OKCANCEL $(PIDGINPROMPTCONTINUEWITHOUTUNINSTALL
) /SD
IDOK IDOK done
241 ;--------------------------------
242 ;GTK+ Runtime Install Section
244 Section $(GTKSECTIONTITLE
) SecGtk
247 StrCpy $R1 "$PLUGINSDIR\gtk.zip"
248 !ifdef OFFLINE_INSTALLER
250 SetOutPath $PLUGINSDIR
251 File /oname=gtk
.zip
".\gtk-runtime-${GTK_INSTALL_VERSION}.zip"
255 ; We need to download the GTK+ runtime
257 StrCpy $R2 "${DOWNLOADER_URL}>k_version=${GTK_INSTALL_VERSION}&dl_pkg=gtk"
258 DetailPrint "Downloading GTK+ Runtime ... ($R2)"
259 NSISdl::download
/TIMEOUT=
10000 "$R2" "$R1"
261 ;StrCmp $R0 "cancel" done
262 StrCmp $R0 "success" 0 prompt_retry
264 Push "${GTK_SHA1SUM}"
265 Push "$R1" ; Filename
269 StrCmp "$R0" "0" extract
271 MessageBox MB_RETRYCANCEL "$(PIDGINGTKDOWNLOADERROR)" /SD
IDCANCEL IDRETRY retry
IDCANCEL done
276 ;Delete the old Gtk directory
277 RMDir /r
"$INSTDIR\Gtk"
279 SetOutPath "$INSTDIR"
280 nsisunz::UnzipToLog
$R1 "$INSTDIR"
282 StrCmp $R0 "success" +2
283 DetailPrint "$R0" ;print error message to log
285 !ifndef OFFLINE_INSTALLER
288 SectionEnd ; end of GTK+ section
290 ;--------------------------------
291 ;Pidgin Install Section
293 Section $(PIDGINSECTIONTITLE
) SecPidgin
296 ; Check install rights..
297 Call CheckUserInstallRights
300 StrCmp $R0 "NONE" pidgin_install_files
301 StrCmp $R0 "HKLM" pidgin_hklm pidgin_hkcu
304 WriteRegStr HKLM "${HKLM_APP_PATHS_KEY}" "" "$INSTDIR\pidgin.exe"
305 WriteRegStr HKLM "${HKLM_APP_PATHS_KEY}" "Path" "$INSTDIR\Gtk\bin"
306 WriteRegStr HKLM ${PIDGIN_REG_KEY} "" "$INSTDIR"
307 WriteRegStr HKLM ${PIDGIN_REG_KEY} "Version" "${PIDGIN_VERSION}"
308 WriteRegStr HKLM "${PIDGIN_UNINSTALL_KEY}" "DisplayIcon" "$INSTDIR\pidgin.exe"
309 WriteRegStr HKLM "${PIDGIN_UNINSTALL_KEY}" "DisplayName" "Pidgin"
310 WriteRegStr HKLM "${PIDGIN_UNINSTALL_KEY}" "DisplayVersion" "${PIDGIN_VERSION}"
311 WriteRegStr HKLM "${PIDGIN_UNINSTALL_KEY}" "HelpLink" "https://developer.pidgin.im/wiki/Using Pidgin"
312 WriteRegDWORD HKLM "${PIDGIN_UNINSTALL_KEY}" "NoModify" 1
313 WriteRegDWORD HKLM "${PIDGIN_UNINSTALL_KEY}" "NoRepair" 1
314 WriteRegStr HKLM "${PIDGIN_UNINSTALL_KEY}" "UninstallString" "$INSTDIR\${PIDGIN_UNINST_EXE}"
315 ; Sets scope of the desktop and Start Menu entries for all users.
316 SetShellVarContext
"all"
317 Goto pidgin_install_files
320 WriteRegStr HKCU ${PIDGIN_REG_KEY} "" "$INSTDIR"
321 WriteRegStr HKCU ${PIDGIN_REG_KEY} "Version" "${PIDGIN_VERSION}"
322 WriteRegStr HKCU "${PIDGIN_UNINSTALL_KEY}" "DisplayIcon" "$INSTDIR\pidgin.exe"
323 WriteRegStr HKCU "${PIDGIN_UNINSTALL_KEY}" "DisplayName" "Pidgin"
324 WriteRegStr HKCU "${PIDGIN_UNINSTALL_KEY}" "DisplayVersion" "${PIDGIN_VERSION}"
325 WriteRegStr HKCU "${PIDGIN_UNINSTALL_KEY}" "HelpLink" "https://developer.pidgin.im/wiki/Using Pidgin"
326 WriteRegDWORD HKCU "${PIDGIN_UNINSTALL_KEY}" "NoModify" 1
327 WriteRegDWORD HKCU "${PIDGIN_UNINSTALL_KEY}" "NoRepair" 1
328 WriteRegStr HKCU "${PIDGIN_UNINSTALL_KEY}" "UninstallString" "$INSTDIR\${PIDGIN_UNINST_EXE}"
329 Goto pidgin_install_files
331 pidgin_install_files:
332 SetOutPath "$INSTDIR"
336 File /r
/x locale
/x Gtk
..\
..\
..\
${PIDGIN_INSTALL_DIR}\
*.*
338 SetOutPath "$INSTDIR"
340 ; If we don't have install rights we're done
341 StrCmp $R0 "NONE" done
344 ; write out uninstaller
346 WriteUninstaller "$INSTDIR\${PIDGIN_UNINST_EXE}"
349 ; If we previously had pidgin set up to run on startup, make it do so again
350 StrCmp $STARTUP_RUN_KEY "HKCU" +1 +2
351 WriteRegStr HKCU "${STARTUP_RUN_KEY}" "Pidgin" "$INSTDIR\pidgin.exe"
352 StrCmp $STARTUP_RUN_KEY "HKLM" +1 +2
353 WriteRegStr HKLM "${STARTUP_RUN_KEY}" "Pidgin" "$INSTDIR\pidgin.exe"
356 SectionEnd ; end of default Pidgin section
358 ;--------------------------------
361 SectionGroup
/e
$(PIDGINSHORTCUTSSECTIONTITLE
) SecShortcuts
362 Section /o
$(PIDGINDESKTOPSHORTCUTSECTIONTITLE
) SecDesktopShortcut
364 CreateShortCut "$DESKTOP\Pidgin.lnk" "$INSTDIR\pidgin.exe"
367 Section $(PIDGINSTARTMENUSHORTCUTSECTIONTITLE
) SecStartMenuShortcut
369 CreateShortCut "$SMPROGRAMS\Pidgin.lnk" "$INSTDIR\pidgin.exe"
374 ;--------------------------------
377 !macro URI_SECTION proto
378 Section /o
"${proto}:" SecURI_
${proto}
380 Call RegisterURIHandler
383 SectionGroup
/e
$(URIHANDLERSSECTIONTITLE
) SecURIHandlers
384 !insertmacro URI_SECTION
"aim"
385 !insertmacro URI_SECTION
"msnim"
386 !insertmacro URI_SECTION
"ymsgr"
387 !insertmacro URI_SECTION
"xmpp"
390 ;--------------------------------
393 !macro LANG_SECTION lang
394 ${MementoUnselectedSection} "${lang}" SecLang_
${lang}
395 SetOutPath "$INSTDIR\locale\${lang}\LC_MESSAGES"
396 File "..\..\..\${PIDGIN_INSTALL_DIR}\locale\${lang}\LC_MESSAGES\*.mo"
397 SetOutPath "$INSTDIR"
400 SectionGroup
$(TRANSLATIONSSECTIONTITLE
) SecTranslations
401 # pidgin-translations is generated based on the contents of the locale directory
402 !include "pidgin-translations.nsh"
404 ${MementoSectionDone}
406 ;--------------------------------
409 !macro SPELLCHECK_SECTION lang lang_name lang_file
410 Section /o
"${lang_name}" SecSpell_
${lang}
416 SectionGroup
$(PIDGINSPELLCHECKSECTIONTITLE
) SecSpellCheck
417 !include "pidgin-spellcheck.nsh"
420 Section /o
$(DEBUGSYMBOLSSECTIONTITLE
) SecDebugSymbols
423 StrCpy $R1 "$PLUGINSDIR\dbgsym.zip"
424 !ifdef OFFLINE_INSTALLER
426 SetOutPath $PLUGINSDIR
427 File /oname=dbgsym
.zip
"..\..\..\pidgin-${PIDGIN_VERSION}-dbgsym.zip"
431 ; We need to download the debug symbols
433 StrCpy $R2 "${DOWNLOADER_URL}&dl_pkg=dbgsym"
434 DetailPrint "Downloading Debug Symbols... ($R2)"
435 NSISdl::download
/TIMEOUT=
10000 "$R2" "$R1"
437 StrCmp $R0 "cancel" done
438 StrCmp $R0 "success" 0 prompt_retry
440 Push "${DEBUG_SYMBOLS_SHA1SUM}"
441 Push "$R1" ; Filename
445 StrCmp "$R0" "0" extract
447 MessageBox MB_RETRYCANCEL "$(PIDGINDEBUGSYMBOLSERROR)" /SD
IDCANCEL IDRETRY retry
IDCANCEL done
452 SetOutPath "$INSTDIR"
453 nsisunz::UnzipToLog
$R1 "$INSTDIR"
455 StrCmp $R0 "success" +2
456 DetailPrint "$R0" ;print error message to log
458 !ifndef OFFLINE_INSTALLER
463 ;--------------------------------
468 Call un
.CheckUserInstallRights
470 StrCmp $R0 "NONE" no_rights
471 StrCmp $R0 "HKCU" try_hkcu try_hklm
474 ReadRegStr $R0 HKCU ${PIDGIN_REG_KEY} ""
475 StrCmp $R0 $INSTDIR 0 cant_uninstall
476 ; HKCU install path matches our INSTDIR so uninstall
477 DeleteRegKey HKCU ${PIDGIN_REG_KEY}
478 DeleteRegKey HKCU "${PIDGIN_UNINSTALL_KEY}"
482 ReadRegStr $R0 HKLM ${PIDGIN_REG_KEY} ""
483 StrCmp $R0 $INSTDIR 0 try_hkcu
484 ; HKLM install path matches our INSTDIR so uninstall
485 DeleteRegKey HKLM ${PIDGIN_REG_KEY}
486 DeleteRegKey HKLM "${PIDGIN_UNINSTALL_KEY}"
487 DeleteRegKey HKLM "${HKLM_APP_PATHS_KEY}"
488 ; Sets start menu and desktop scope to all users..
489 SetShellVarContext
"all"
492 ; The WinPrefs plugin may have left this behind..
493 DeleteRegValue HKCU "${STARTUP_RUN_KEY}" "Pidgin"
494 DeleteRegValue HKLM "${STARTUP_RUN_KEY}" "Pidgin"
495 ; Remove Language preference info
496 DeleteRegValue HKCU "${PIDGIN_REG_KEY}" "${MUI_LANGDLL_REGISTRY_VALUENAME}"
498 ; Remove any URI handlers
499 ; I can't think of an easy way to maintain a list in a single place
501 Call un
.UnregisterURIHandler
503 Call un
.UnregisterURIHandler
505 Call un
.UnregisterURIHandler
507 Call un
.UnregisterURIHandler
509 ; Some of these aren't shipped anymore. Delete them anyway.
510 Delete "$INSTDIR\ca-certs\AddTrust_External_Root.pem"
511 Delete "$INSTDIR\ca-certs\America_Online_Root_Certification_Authority_1.pem"
512 Delete "$INSTDIR\ca-certs\AOL_Member_CA.pem"
513 Delete "$INSTDIR\ca-certs\Baltimore_CyberTrust_Root.pem"
514 Delete "$INSTDIR\ca-certs\CAcert_Class3.pem"
515 Delete "$INSTDIR\ca-certs\CAcert_Root.pem"
516 Delete "$INSTDIR\ca-certs\Deutsche_Telekom_Root_CA_2.pem"
517 Delete "$INSTDIR\ca-certs\DigiCertHighAssuranceCA-3.pem"
518 Delete "$INSTDIR\ca-certs\DigiCertHighAssuranceEVRootCA.pem"
519 Delete "$INSTDIR\ca-certs\Entrust.net_Secure_Server_CA.pem"
520 Delete "$INSTDIR\ca-certs\Equifax_Secure_CA.pem"
521 Delete "$INSTDIR\ca-certs\Equifax_Secure_Global_eBusiness_CA-1.pem"
522 Delete "$INSTDIR\ca-certs\Go_Daddy_Class_2_CA.pem"
523 Delete "$INSTDIR\ca-certs\GTE_CyberTrust_Global_Root.pem"
524 Delete "$INSTDIR\ca-certs\Microsoft_Internet_Authority.pem"
525 Delete "$INSTDIR\ca-certs\Microsoft_Internet_Authority_2010.pem"
526 Delete "$INSTDIR\ca-certs\Microsoft_Secure_Server_Authority.pem"
527 Delete "$INSTDIR\ca-certs\Microsoft_Secure_Server_Authority_2010.pem"
528 Delete "$INSTDIR\ca-certs\StartCom_Certification_Authority.pem"
529 Delete "$INSTDIR\ca-certs\StartCom_Free_SSL_CA.pem"
530 Delete "$INSTDIR\ca-certs\Thawte_Premium_Server_CA.pem"
531 Delete "$INSTDIR\ca-certs\Thawte_Primary_Root_CA.pem"
532 Delete "$INSTDIR\ca-certs\ValiCert_Class_2_VA.pem"
533 Delete "$INSTDIR\ca-certs\VeriSign_Class3_Extended_Validation_CA.pem"
534 Delete "$INSTDIR\ca-certs\Verisign_Class3_Primary_CA.pem"
535 Delete "$INSTDIR\ca-certs\VeriSign_Class_3_Primary_CA-G2.pem"
536 Delete "$INSTDIR\ca-certs\VeriSign_Class_3_Primary_CA-G5.pem"
537 Delete "$INSTDIR\ca-certs\VeriSign_Class_3_Primary_CA-G5-2.pem"
538 Delete "$INSTDIR\ca-certs\VeriSign_International_Server_Class_3_CA.pem"
539 Delete "$INSTDIR\ca-certs\Verisign_RSA_Secure_Server_CA.pem"
540 Delete "$INSTDIR\ca-certs\mozilla.pem"
541 RMDir "$INSTDIR\ca-certs"
542 RMDir /r
"$INSTDIR\locale"
543 RMDir /r
"$INSTDIR\pixmaps"
544 RMDir /r
"$INSTDIR\theme"
545 Delete "$INSTDIR\plugins\autoaccept.dll"
546 Delete "$INSTDIR\plugins\buddynote.dll"
547 Delete "$INSTDIR\plugins\convcolors.dll"
548 Delete "$INSTDIR\plugins\extplacement.dll"
549 Delete "$INSTDIR\plugins\gtkbuddynote.dll"
550 Delete "$INSTDIR\plugins\history.dll"
551 Delete "$INSTDIR\plugins\internalkeyring.dll"
552 Delete "$INSTDIR\plugins\ssl-gnutls.dll"
553 Delete "$INSTDIR\plugins\webkit.dll"
554 Delete "$INSTDIR\plugins\wincred.dll"
555 Delete "$INSTDIR\plugins\iconaway.dll"
556 Delete "$INSTDIR\plugins\idle.dll"
557 Delete "$INSTDIR\plugins\joinpart.dll"
558 Delete "$INSTDIR\plugins\libbonjour.dll"
559 Delete "$INSTDIR\plugins\libgg.dll"
560 Delete "$INSTDIR\plugins\libirc.dll"
561 Delete "$INSTDIR\plugins\libjabber.dll"
562 Delete "$INSTDIR\plugins\libmsn.dll"
563 Delete "$INSTDIR\plugins\libmxit.dll"
564 Delete "$INSTDIR\plugins\libnovell.dll"
565 Delete "$INSTDIR\plugins\liboscar.dll"
566 Delete "$INSTDIR\plugins\libsametime.dll"
567 Delete "$INSTDIR\plugins\libsilc.dll"
568 Delete "$INSTDIR\plugins\libsimple.dll"
569 Delete "$INSTDIR\plugins\libyahoo.dll"
570 Delete "$INSTDIR\plugins\log_reader.dll"
571 Delete "$INSTDIR\plugins\markerline.dll"
572 Delete "$INSTDIR\plugins\newline.dll"
573 Delete "$INSTDIR\plugins\notify.dll"
574 Delete "$INSTDIR\plugins\nss-prefs.dll"
575 Delete "$INSTDIR\plugins\offlinemsg.dll"
576 Delete "$INSTDIR\plugins\perl.dll"
577 Delete "$INSTDIR\plugins\pidginrc.dll"
578 Delete "$INSTDIR\plugins\psychic.dll"
579 Delete "$INSTDIR\plugins\relnot.dll"
580 Delete "$INSTDIR\plugins\sendbutton.dll"
581 Delete "$INSTDIR\plugins\spellchk.dll"
582 Delete "$INSTDIR\plugins\ssl-nss.dll"
583 Delete "$INSTDIR\plugins\ssl.dll"
584 Delete "$INSTDIR\plugins\statenotify.dll"
585 Delete "$INSTDIR\plugins\ticker.dll"
586 Delete "$INSTDIR\plugins\timestamp.dll"
587 Delete "$INSTDIR\plugins\timestamp_format.dll"
588 Delete "$INSTDIR\plugins\win2ktrans.dll"
589 Delete "$INSTDIR\plugins\winprefs.dll"
590 Delete "$INSTDIR\plugins\xmppconsole.dll"
591 Delete "$INSTDIR\plugins\xmppdisco.dll"
592 Delete "$INSTDIR\plugins\perl\auto\Pidgin\Pidgin.dll"
593 RMDir "$INSTDIR\plugins\perl\auto\Pidgin"
594 Delete "$INSTDIR\plugins\perl\auto\Purple\autosplit.ix"
595 Delete "$INSTDIR\plugins\perl\auto\Purple\Purple.dll"
596 RMDir "$INSTDIR\plugins\perl\auto\Purple"
597 RMDir "$INSTDIR\plugins\perl\auto"
598 Delete "$INSTDIR\plugins\perl\Pidgin.pm"
599 Delete "$INSTDIR\plugins\perl\Purple.pm"
600 RMDir "$INSTDIR\plugins\perl"
601 RMDir "$INSTDIR\plugins"
602 Delete "$INSTDIR\sasl2\libanonymous-3.dll"
603 Delete "$INSTDIR\sasl2\libcrammd5-3.dll"
604 Delete "$INSTDIR\sasl2\libdigestmd5-3.dll"
605 Delete "$INSTDIR\sasl2\libplain-3.dll"
606 RMDir "$INSTDIR\sasl2"
607 Delete "$INSTDIR\sounds\purple\alert.wav"
608 Delete "$INSTDIR\sounds\purple\login.wav"
609 Delete "$INSTDIR\sounds\purple\logout.wav"
610 Delete "$INSTDIR\sounds\purple\receive.wav"
611 Delete "$INSTDIR\sounds\purple\send.wav"
612 RMDir "$INSTDIR\sounds\purple"
613 RMDir "$INSTDIR\sounds"
614 Delete "$INSTDIR\spellcheck\libenchant.dll"
615 Delete "$INSTDIR\spellcheck\lib\enchant\libenchant_aspell.dll"
616 Delete "$INSTDIR\spellcheck\lib\enchant\libenchant_ispell.dll"
617 Delete "$INSTDIR\spellcheck\lib\enchant\libenchant_myspell.dll"
618 RMDir "$INSTDIR\spellcheck\lib\enchant"
619 RMDir "$INSTDIR\spellcheck\lib"
620 RMDir "$INSTDIR\spellcheck"
621 Delete "$INSTDIR\freebl3.dll"
622 Delete "$INSTDIR\libnspr4.dll"
623 Delete "$INSTDIR\libmeanwhile-1.dll"
624 Delete "$INSTDIR\libplc4.dll"
625 Delete "$INSTDIR\libplds4.dll"
626 Delete "$INSTDIR\libpurple.dll"
627 Delete "$INSTDIR\libsasl2-3.dll"
628 Delete "$INSTDIR\libsilc-1-1-4.dll"
629 Delete "$INSTDIR\libsilcclient-1-1-4.dll"
630 Delete "$INSTDIR\libssp-0.dll"
631 Delete "$INSTDIR\libxml2-2.dll"
632 Delete "$INSTDIR\nss3.dll"
633 Delete "$INSTDIR\nssutil3.dll"
634 Delete "$INSTDIR\pidgin.dll"
635 Delete "$INSTDIR\pidgin.exe"
636 Delete "$INSTDIR\smime3.dll"
637 Delete "$INSTDIR\softokn3.dll"
638 Delete "$INSTDIR\sqlite3.dll"
639 Delete "$INSTDIR\ssl3.dll"
640 Delete "$INSTDIR\${PIDGIN_UNINST_EXE}"
641 Delete "$INSTDIR\exchndl.dll"
642 Delete "$INSTDIR\install.log"
644 ; Remove the debug symbols
645 RMDir /r
"$INSTDIR\pidgin-${PIDGIN_VERSION}-dbgsym"
647 ; Remove the local GTK+ copy (if we're not just upgrading)
650 ${GetOptions} "$R0" "/UPGRADE=" $R1
652 StrCmp $R1 "1" upgrade_done
653 RMDir /r
"$INSTDIR\Gtk"
654 ; Remove the downloaded spellcheck dictionaries (if we're not just upgrading)
655 RMDir /r
"$INSTDIR\spellcheck"
658 ;Try to remove Pidgin install dir (only if empty)
662 Delete "$DESKTOP\Pidgin.lnk"
663 Delete "$SMPROGRAMS\Pidgin.lnk"
668 MessageBox MB_OK $(PIDGINUNINSTALLERROR1
) /SD
IDOK
672 MessageBox MB_OK $(PIDGINUNINSTALLERROR2
) /SD
IDOK
676 SectionEnd ; end of uninstall section
678 ;--------------------------------
680 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
681 !insertmacro MUI_DESCRIPTION_TEXT
${SecPidgin} \
682 $(PIDGINSECTIONDESCRIPTION
)
683 !insertmacro MUI_DESCRIPTION_TEXT
${SecGtk} \
684 $(GTKSECTIONDESCRIPTION
)
686 !insertmacro MUI_DESCRIPTION_TEXT
${SecShortcuts} \
687 $(PIDGINSHORTCUTSSECTIONDESCRIPTION
)
688 !insertmacro MUI_DESCRIPTION_TEXT
${SecDesktopShortcut} \
689 $(PIDGINDESKTOPSHORTCUTDESC
)
690 !insertmacro MUI_DESCRIPTION_TEXT
${SecStartMenuShortcut} \
691 $(PIDGINSTARTMENUSHORTCUTDESC
)
693 !insertmacro MUI_DESCRIPTION_TEXT
${SecSpellCheck} \
694 $(PIDGINSPELLCHECKSECTIONDESCRIPTION
)
696 !insertmacro MUI_FUNCTION_DESCRIPTION_END
698 ;--------------------------------
701 ; Default the URI handler checkboxes if Pidgin is the current handler or if there is no handler
702 Function SelectURIHandlerSelections
708 ; Start with the first URI handler
709 IntOp $R0 ${SecURIHandlers} + 1
712 ; If it is the end of the section group, stop
713 SectionGetFlags
$R0 $R1
714 IntOp $R2 $R1 & ${SF_SECGRPEND}
715 IntCmp $R2 ${SF_SECGRPEND} done
717 SectionGetText
$R0 $R2
718 ;Strip the trailing ':'
724 ReadRegStr $R3 HKCR "$R2" ""
725 IfErrors default_on
;there is no current handler
728 Call CheckIfPidginIsCurrentURIHandler
731 ; If Pidgin isn't the current handler, we don't steal it automatically
732 IntCmp $R3 0 end_loop
734 ;We default the URI handler checkbox on
736 IntOp $R1 $R1 |
${SF_SELECTED} ; Select
737 SectionSetFlags
$R0 $R1
740 IntOp $R0 $R0 + 1 ;Advance to the next section
748 FunctionEnd ;SelectURIHandlerSections
750 ; Check if Pidgin is the current handler
751 ; Returns a boolean on the stack
752 !macro CheckIfPidginIsCurrentURIHandlerMacro UN
753 Function ${UN}CheckIfPidginIsCurrentURIHandler
757 ReadRegStr $R0 HKCR "$R0\shell\Open\command" ""
763 ${un
.WordFind
} "$R0" "pidgin.exe" "E+1{" $R0
765 ${WordFind} "$R0" "pidgin.exe" "E+1{" $R0
775 !insertmacro CheckIfPidginIsCurrentURIHandlerMacro
""
776 !insertmacro CheckIfPidginIsCurrentURIHandlerMacro
"un."
778 ; If Pidgin is the current URI handler for the specified protocol, remove it.
779 Function un
.UnregisterURIHandler
784 Call un
.CheckIfPidginIsCurrentURIHandler
787 ; If Pidgin isn't the current handler, leave it as-is
790 ;Unregister the URI handler
791 DetailPrint "Unregistering $R0 URI Handler"
792 DeleteRegKey HKCR "$R0"
799 Function RegisterURIHandler
801 DetailPrint "Registering $R0 URI Handler"
802 DeleteRegKey HKCR "$R0"
803 WriteRegStr HKCR "$R0" "" "URL:$R0"
804 WriteRegStr HKCR "$R0" "URL Protocol" ""
805 WriteRegStr HKCR "$R0\DefaultIcon" "" "$INSTDIR\pidgin.exe"
806 WriteRegStr HKCR "$R0\shell" "" ""
807 WriteRegStr HKCR "$R0\shell\Open" "" ""
808 WriteRegStr HKCR "$R0\shell\Open\command" "" "$INSTDIR\pidgin.exe --protocolhandler=%1"
813 !macro CheckUserInstallRightsMacro UN
814 Function ${UN}CheckUserInstallRights
821 UserInfo::GetAccountType
824 StrCmp $1 "Admin" 0 +3
827 StrCmp $1 "Power" 0 +3
830 StrCmp $1 "User" 0 +3
833 StrCmp $1 "Guest" 0 +3
849 !insertmacro CheckUserInstallRightsMacro
""
850 !insertmacro CheckUserInstallRightsMacro
"un."
854 ; Push $0 ; Path string
856 ; Pop $0 ; 0 - Bad path 1 - Good path
863 IfFileExists $0 dir_exists
864 StrCpy $1 $0 ; save last
867 ; IfFileExists "C:" on xp returns true and on win2k returns false
868 ; So we're done in such a case..
869 IntCmp $2 2 loop_done
870 ; GetParent of "C:" returns ""
871 IntCmp $2 0 loop_done
875 StrCpy $1 "$0\GaImFooB"
876 ; Check if we can create dir on this drive..
879 IfErrors DirBad DirGood
883 FileOpen $1 "$0\pidginfoo.bar" w
884 IfErrors PathBad PathGood
896 Delete "$0\pidginfoo.bar"
904 Delete "$0\pidginfoo.bar"
910 Exch 3 ; The top of the stack contains the output variable
916 Function .onVerifyInstDir
921 StrCmp $0 "0" 0 dir_good
933 ; 0 - We have the correct version
934 ; 1 - We have an old version that should work, prompt user for optional upgrade
935 ; 2 - We have an old version that needs to be upgraded
936 ; 3 - We don't have Gtk+ at all
942 IfFileExists "$INSTDIR\Gtk\CONTENTS" +3
947 ${ConfigRead} "$INSTDIR\Gtk\CONTENTS" "Bundle Version " $0
952 ${VersionCompare} ${GTK_INSTALL_VERSION} $0 $1
954 Push "0" ; Have a good version
957 ${VersionCompare} ${GTK_MIN_VERSION} $0 $1
959 Push "1" ; Optional Upgrade
961 Push "2" ; Mandatory Upgrade
965 ; The item on the stack is what we want to return
973 !macro RunCheckMacro UN
974 Function ${UN}RunCheck
980 ; Close the Handle (needed if we're retrying)
982 System::Call 'kernel32::CloseHandle(i $R1) i .R1'
983 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "pidgin_is_running") i .R1 ?e'
985 IntCmp $R0 0 +3 ;This could check for ERROR_ALREADY_EXISTS(183), but lets just assume
986 MessageBox MB_RETRYCANCEL|
MB_ICONEXCLAMATION $(PIDGINISRUNNING
) /SD
IDCANCEL IDRETRY retry_runcheck
989 ; Close the Handle (If we don't do this, the uninstaller called from within will fail)
990 ; This is not optimal because there is a (small) window of time when a new process could start
991 System::Call 'kernel32::CloseHandle(i $R1) i .R1'
997 !insertmacro RunCheckMacro
""
998 !insertmacro RunCheckMacro
"un."
1004 Push $R3 ; This is only used for the Parameters throughout the function
1006 ${GetParameters} $R3
1010 ; Close the Handle (needed if we're retrying)
1012 System::Call 'kernel32::CloseHandle(i $R1) i .R1'
1013 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "pidgin_installer_running") i .R1 ?e'
1015 IntCmp $R0 0 +3 ;This could check for ERROR_ALREADY_EXISTS(183), but lets just assume
1016 MessageBox MB_RETRYCANCEL|
MB_ICONEXCLAMATION $(INSTALLERISRUNNING
) /SD
IDCANCEL IDRETRY retry_runcheck
1019 ; Allow installer to run even if pidgin is running via "/NOPIDGINRUNCHECK=1"
1020 ; This is useful for testing
1022 ${GetOptions} "$R3" "/NOPIDGINRUNCHECK=" $R1
1026 StrCpy $name "Pidgin ${PIDGIN_VERSION}"
1028 ;Try to copy the old Gaim installer Lang Reg. key
1029 ;(remove it after we're done to prevent this being done more than once)
1031 ReadRegStr $R0 HKCU "${PIDGIN_REG_KEY}" "${MUI_LANGDLL_REGISTRY_VALUENAME}"
1034 ReadRegStr $R0 HKCU "${OLD_GAIM_REG_KEY}" "${MUI_LANGDLL_REGISTRY_VALUENAME}"
1036 DeleteRegValue HKCU "${OLD_GAIM_REG_KEY}" "${MUI_LANGDLL_REGISTRY_VALUENAME}"
1037 WriteRegStr HKCU "${PIDGIN_REG_KEY}" "${MUI_LANGDLL_REGISTRY_VALUENAME}" "$R0"
1039 ${MementoSectionRestore}
1041 ;Preselect the URI handlers as appropriate
1042 Call SelectURIHandlerSelections
1044 ;Preselect the "shortcuts" checkboxes according to the previous installation
1046 ;Make sure that there was a previous installation
1047 ReadRegStr $R0 HKCU "${PIDGIN_REG_KEY}" "${MUI_LANGDLL_REGISTRY_VALUENAME}"
1048 IfErrors done_preselecting_shortcuts
1049 ;Does the Desktop shortcut exist?
1050 GetFileTime "$DESKTOP\Pidgin.lnk" $R0 $R0
1053 SetShellVarContext
"all"
1054 GetFileTime "$DESKTOP\Pidgin.lnk" $R0 $R0
1055 IfErrors preselect_startmenu_shortcut
;Desktop Shortcut if off by default
1056 !insertmacro SelectSection
${SecDesktopShortcut}
1057 preselect_startmenu_shortcut:
1058 ;Reset ShellVarContext because we may have changed it
1059 SetShellVarContext
"current"
1061 ;Does the StartMenu shortcut exist?
1062 GetFileTime "$SMPROGRAMS\Pidgin.lnk" $R0 $R0
1063 IfErrors +1 done_preselecting_shortcuts
;StartMenu Shortcut is on by default
1065 SetShellVarContext
"all"
1066 GetFileTime "$SMPROGRAMS\Pidgin.lnk" $R0 $R0
1067 IfErrors +1 done_preselecting_shortcuts
;StartMenu Shortcut is on by default
1068 !insertmacro UnselectSection
${SecStartMenuShortcut}
1069 done_preselecting_shortcuts:
1070 ;Reset ShellVarContext because we may have changed it
1071 SetShellVarContext
"current"
1074 ${GetOptions} "$R3" "/L=" $R1
1076 StrCpy $LANGUAGE $R1
1080 ; Display Language selection dialog
1081 !define MUI_LANGDLL_ALWAYSSHOW
1082 !insertmacro MUI_LANGDLL_DISPLAY
1086 ${GetOptions} "$R3" "/DS=" $R1
1088 SectionGetFlags
${SecDesktopShortcut} $R2
1090 IntOp $R2 $R2 |
${SF_SELECTED}
1092 IntOp $R1 ${SF_SELECTED} ~
1094 SectionSetFlags
${SecDesktopShortcut} $R2
1097 ${GetOptions} "$R3" "/SMS=" $R1
1099 SectionGetFlags
${SecStartMenuShortcut} $R2
1101 IntOp $R2 $R2 |
${SF_SELECTED}
1103 IntOp $R1 ${SF_SELECTED} ~
1105 SectionSetFlags
${SecStartMenuShortcut} $R2
1107 ; If install path was set on the command, use it.
1108 StrCmp $INSTDIR "" 0 instdir_done
1110 ; If pidgin or gaim is currently installed, we should default to where it is currently installed
1112 ReadRegStr $INSTDIR HKCU "${PIDGIN_REG_KEY}" ""
1114 StrCmp $INSTDIR "" 0 instdir_done
1116 ReadRegStr $INSTDIR HKLM "${PIDGIN_REG_KEY}" ""
1118 StrCmp $INSTDIR "" 0 instdir_done
1120 Call CheckUserInstallRights
1123 StrCmp $R0 "HKLM" 0 user_dir
1124 StrCpy $INSTDIR "$PROGRAMFILES\Pidgin"
1128 ${GetParent} $SMPROGRAMS $R2
1129 ${GetParent} $R2 $R2
1130 StrCpy $INSTDIR "$R2\Pidgin"
1135 ; Try to select a translation and a dictionary for the currently selected Language
1136 Call SelectTranslationForCurrentLanguage
1138 ;Mark the dictionaries that are already installed as readonly
1139 Call SelectAndDisableInstalledDictionaries
1147 Function .onInstSuccess
1149 ${MementoSectionSave}
1157 StrCpy $name "Pidgin ${PIDGIN_VERSION}"
1160 ; Get stored language preference
1161 !insertmacro MUI_UNGETLANGUAGE
1165 ; Page enter and exit functions..
1167 Function preWelcomePage
1171 !ifdef OFFLINE_INSTALLER
1172 !insertmacro SelectSection
${SecDebugSymbols}
1176 Pop $CURRENT_GTK_STATE
1177 StrCpy $WARNED_GTK_STATE "0"
1178 IntCmp $CURRENT_GTK_STATE 1 done gtk_not_mandatory
1179 ; Make the GTK+ Section RO if it is required. (it is required only if you have an existing version that is too old)
1180 StrCmp $CURRENT_GTK_STATE "2" 0 done
1181 !insertmacro SetSectionFlag
${SecGtk} ${SF_RO}
1184 ; Don't select the GTK+ section if we already have this version or newer installed
1185 !insertmacro UnselectSection
${SecGtk}
1192 ; If the GTK+ Section has been unselected and there isn't a compatible GTK+ already, confirm
1193 Function .onSelChange
1196 SectionGetFlags
${SecGtk} $R0
1197 IntOp $R0 $R0 & ${SF_SELECTED}
1198 ; If the Gtk Section is currently selected, reset the "Warned" flag
1199 StrCmp $R0 "${SF_SELECTED}" 0 +3
1200 StrCpy $WARNED_GTK_STATE "0"
1203 ; If we've already warned the user, don't warn them again
1204 StrCmp $WARNED_GTK_STATE "1" done
1205 IntCmp $CURRENT_GTK_STATE 1 done done
0
1206 StrCpy $WARNED_GTK_STATE "1"
1207 MessageBox MB_YESNO $(PIDGINPROMPTFORCENOGTK
) /SD
IDNO IDYES done
1208 !insertmacro SelectSection
${SecGtk}
1214 Function SelectTranslationForCurrentLanguage
1215 !insertmacro SELECT_TRANSLATION_FUNCTION
1218 ; SpellChecker Related Functions
1219 ;-------------------------------
1221 ; Select and Disable any Sections that have currently installed dictionaries
1222 !macro CHECK_SPELLCHECK_SECTION lang
1223 ;Advance to the next (correct) section index
1225 IfFileExists "$INSTDIR\spellcheck\share\enchant\myspell\${lang}.dic" 0 done_
${lang}
1226 SectionGetFlags
$R0 $R1
1227 IntOp $R1 $R1 |
${SF_RO} ; Mark Readonly
1228 IntOp $R1 $R1 |
${SF_SELECTED} ; Select
1229 SectionSetFlags
$R0 $R1
1232 Function SelectAndDisableInstalledDictionaries
1236 !insertmacro SetSectionFlag
${SecSpellCheck} ${SF_RO}
1237 !insertmacro UnselectSection
${SecSpellCheck}
1239 IntOp $R0 ${SecSpellCheck} + 0
1240 !include "pidgin-spellcheck-preselect.nsh"
1246 Function InstallDict
1249 Pop $R0 ;This is the language code
1252 Pop $R1 ;This is the language file
1258 IfFileExists "$INSTDIR\spellcheck\share\enchant\myspell\$R0.dic" installed
1262 ; We need to download and install dictionary
1263 StrCpy $R2 "$PLUGINSDIR\$R1"
1264 StrCpy $R3 "${DOWNLOADER_URL}&dl_pkg=oo_dict&lang=$R1&lang_file=$R1"
1265 DetailPrint "Downloading the $R0 Dictionary... ($R3)"
1267 NSISdl::download
/TIMEOUT=
10000 "$R3" "$R2"
1269 StrCmp $R4 "cancel" done
1270 StrCmp $R4 "success" +3
1271 MessageBox MB_RETRYCANCEL "$(PIDGINSPELLCHECKERROR)" /SD
IDCANCEL IDRETRY retry
IDCANCEL done
1273 SetOutPath "$INSTDIR\spellcheck\share\enchant\myspell"
1274 nsisunz::UnzipToLog
"$R2" "$OUTDIR"
1275 SetOutPath "$INSTDIR"
1277 StrCmp $R3 "success" installed
1278 DetailPrint "$R3" ;print error message to log
1281 installed: ;The dictionary is currently installed, no error message
1282 DetailPrint "$R0 Dictionary is installed"
1292 !ifndef OFFLINE_INSTALLER
1293 ; Input Stack: Filename, SHA1sum
1294 ; Output Return Code: 0=Match; 1=FileSum error; 2=Mismatch
1295 Function CheckSHA1Sum
1304 SHA1Plugin::FileSum
"$R0"
1309 DetailPrint "SHA1Sum calculation error: $R0"
1313 ; Compare the SHA1Sums
1315 DetailPrint "SHA1Sum mismatch... Expected $R2; got $R0"
1322 Exch $R1 ;$R1 has the return code