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"
38 !include "LogicLib.nsh"
39 !include "Memento.nsh"
41 !include "FileFunc.nsh"
42 !insertmacro GetParameters
43 !insertmacro GetOptions
44 !insertmacro GetParent
46 !include "WordFunc.nsh"
47 !insertmacro VersionCompare
49 !insertmacro un
.WordFind
51 !include "TextFunc.nsh"
53 ;--------------------------------
56 !define PIDGIN_NSIS_INCLUDE_PATH
"."
58 ; Remove these and the stuff that uses them at some point
59 !define OLD_GAIM_REG_KEY
"SOFTWARE\gaim"
60 !define OLD_GAIM_UNINSTALL_KEY
"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Gaim"
61 !define OLD_GAIM_UNINST_EXE
"gaim-uninst.exe"
63 !define PIDGIN_REG_KEY
"SOFTWARE\pidgin"
64 !define PIDGIN_UNINSTALL_KEY
"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Pidgin"
66 !define HKLM_APP_PATHS_KEY
"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\pidgin.exe"
67 !define STARTUP_RUN_KEY
"SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
68 !define PIDGIN_UNINST_EXE
"pidgin-uninst.exe"
70 !define GTK_MIN_VERSION
"2.14.0"
71 !define PERL_REG_KEY
"SOFTWARE\Perl"
72 !define PERL_DLL
"perl510.dll"
74 !define DOWNLOADER_URL
"http://pidgin.im/win32/download_redir.php"
75 !define SPELL_DOWNLOAD_URL
"http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries"
77 !define MEMENTO_REGISTRY_ROOT
HKLM
78 !define MEMENTO_REGISTRY_KEY
"${PIDGIN_UNINSTALL_KEY}"
80 ;--------------------------------
82 VIProductVersion
"${PIDGIN_PRODUCT_VERSION}"
83 VIAddVersionKey
"ProductName" "Pidgin"
84 VIAddVersionKey
"FileVersion" "${PIDGIN_VERSION}"
85 VIAddVersionKey
"ProductVersion" "${PIDGIN_VERSION}"
86 VIAddVersionKey
"LegalCopyright" ""
87 !ifdef OFFLINE_INSTALLER
88 VIAddVersionKey
"FileDescription" "Pidgin Installer (Offline)"
90 VIAddVersionKey
"FileDescription" "Pidgin Installer"
93 ;--------------------------------
94 ;Reserve files used in .onInit
96 ReserveFile
"${NSISDIR}\Plugins\System.dll"
97 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
98 !insertmacro MUI_RESERVEFILE_LANGDLL
100 ;--------------------------------
101 ;Modern UI Configuration
103 !define MUI_ICON
".\pixmaps\pidgin-install.ico"
104 !define MUI_UNICON
".\pixmaps\pidgin-install.ico"
105 !define MUI_WELCOMEFINISHPAGE_BITMAP
".\pixmaps\pidgin-intro.bmp"
106 !define MUI_HEADERIMAGE
107 !define MUI_HEADERIMAGE_BITMAP
".\pixmaps\pidgin-header.bmp"
109 ; Alter License section
110 !define MUI_LICENSEPAGE_BUTTON
$(PIDGINLICENSEBUTTON
)
111 !define MUI_LICENSEPAGE_TEXT_BOTTOM
$(PIDGINLICENSEBOTTOMTEXT
)
113 !define MUI_LANGDLL_REGISTRY_ROOT
"HKCU"
114 !define MUI_LANGDLL_REGISTRY_KEY
${PIDGIN_REG_KEY}
115 !define MUI_LANGDLL_REGISTRY_VALUENAME
"Installer Language"
117 !define MUI_COMPONENTSPAGE_SMALLDESC
118 !define MUI_ABORTWARNING
121 !define MUI_FINISHPAGE_NOAUTOCLOSE
122 !define MUI_FINISHPAGE_RUN
"$INSTDIR\pidgin.exe"
123 !define MUI_FINISHPAGE_RUN_NOTCHECKED
124 !define MUI_FINISHPAGE_LINK
$(PIDGINFINISHVISITWEBSITE
)
125 !define MUI_FINISHPAGE_LINK_LOCATION
"http://pidgin.im"
127 ;--------------------------------
130 !define MUI_PAGE_CUSTOMFUNCTION_PRE preWelcomePage
131 !insertmacro MUI_PAGE_WELCOME
132 !insertmacro MUI_PAGE_LICENSE
"../../../COPYING"
133 !insertmacro MUI_PAGE_COMPONENTS
135 ; Pidgin install dir page
136 !insertmacro MUI_PAGE_DIRECTORY
138 !insertmacro MUI_PAGE_INSTFILES
139 !insertmacro MUI_PAGE_FINISH
141 !insertmacro MUI_UNPAGE_WELCOME
142 !insertmacro MUI_UNPAGE_CONFIRM
143 !insertmacro MUI_UNPAGE_INSTFILES
144 !insertmacro MUI_UNPAGE_FINISH
146 ;--------------------------------
149 !include "${PIDGIN_NSIS_INCLUDE_PATH}\langmacros.nsh"
151 ;--------------------------------
153 ; Only need this if using bzip2 compression
155 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
156 !insertmacro MUI_RESERVEFILE_LANGDLL
157 ReserveFile
"${NSISDIR}\Plugins\UserInfo.dll"
160 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
161 ;; Start Install Sections ;;
162 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
164 ;--------------------------------
165 ;Uninstall any old version of Pidgin (or Gaim)
167 Section -SecUninstallOldPidgin
168 ; Check install rights..
169 Call CheckUserInstallRights
172 ;First try to uninstall Pidgin
173 StrCpy $R4 ${PIDGIN_REG_KEY}
174 StrCpy $R5 ${PIDGIN_UNINSTALL_KEY}
175 StrCpy $R6 ${PIDGIN_UNINST_EXE}
179 ;If pidgin is currently set to run on startup,
180 ; save the section of the Registry where the setting is before uninstalling,
181 ; so we can put it back after installing the new version
183 ReadRegStr $STARTUP_RUN_KEY HKCU "${STARTUP_RUN_KEY}" $R7
185 StrCpy $STARTUP_RUN_KEY "HKCU"
188 ReadRegStr $STARTUP_RUN_KEY HKLM "${STARTUP_RUN_KEY}" $R7
190 StrCpy $STARTUP_RUN_KEY "HKLM"
192 StrCmp $R0 "HKLM" compare_hklm
193 StrCmp $R0 "HKCU" compare_hkcu done
196 ReadRegStr $R1 HKCU $R4 ""
197 ReadRegStr $R2 HKCU $R4 "Version"
198 ReadRegStr $R3 HKCU "$R5" "UninstallString"
202 ReadRegStr $R1 HKLM $R4 ""
203 ReadRegStr $R2 HKLM $R4 "Version"
204 ReadRegStr $R3 HKLM "$R5" "UninstallString"
206 ; If a previous version exists, remove it
208 StrCmp $R1 "" no_version_found
209 ; Version key started with 0.60a3. Prior versions can't be
210 ; automatically uninstalled.
211 StrCmp $R2 "" uninstall_problem
212 ; Check if we have uninstall string..
213 IfFileExists $R3 0 uninstall_problem
214 ; Have uninstall string, go ahead and uninstall.
216 ; Need to copy uninstaller outside of the install dir
218 CopyFiles /SILENT
$R3 "$TEMP\$R6"
220 IfErrors uninstall_problem
221 ; Ready to uninstall..
223 ExecWait '"$TEMP\$R6" /S /UPGRADE=1 _?=$R1'
230 Goto uninstall_problem
233 ;We've already tried to fallback to an old gaim instance
234 StrCmp $R7 "Gaim" done
235 ; If we couldn't uninstall Pidgin, try to uninstall Gaim
236 StrCpy $STARTUP_RUN_KEY "NONE"
237 StrCpy $R4 ${OLD_GAIM_REG_KEY}
238 StrCpy $R5 ${OLD_GAIM_UNINSTALL_KEY}
239 StrCpy $R6 ${OLD_GAIM_UNINST_EXE}
241 Goto start_comparison
244 ; We can't uninstall. Either the user must manually uninstall or we ignore and reinstall over it.
245 MessageBox MB_OKCANCEL $(PIDGINPROMPTCONTINUEWITHOUTUNINSTALL
) /SD
IDOK IDOK done
251 ;--------------------------------
252 ;GTK+ Runtime Install Section
254 Section $(GTKSECTIONTITLE
) SecGtk
257 StrCpy $R1 "$PLUGINSDIR\gtk.zip"
258 !ifdef OFFLINE_INSTALLER
260 SetOutPath $PLUGINSDIR
261 File /oname=gtk
.zip
".\gtk-runtime-${GTK_INSTALL_VERSION}.zip"
265 ; We need to download the GTK+ runtime
267 StrCpy $R2 "${DOWNLOADER_URL}?version=${PIDGIN_VERSION}>k_version=${GTK_INSTALL_VERSION}&dl_pkg=gtk"
268 DetailPrint "Downloading GTK+ Runtime ... ($R2)"
269 NSISdl::download
/TIMEOUT=
10000 $R2 $R1
271 ;StrCmp $R0 "cancel" done
272 StrCmp $R0 "success" +2
273 MessageBox MB_RETRYCANCEL "$(PIDGINGTKDOWNLOADERROR)" /SD
IDCANCEL IDRETRY retry
IDCANCEL done
277 ;Delete the old Gtk directory
278 RMDir /r
"$INSTDIR\Gtk"
280 SetOutPath "$INSTDIR"
281 nsisunz::UnzipToLog
$R1 "$INSTDIR"
283 StrCmp $R0 "success" +2
284 DetailPrint "$R0" ;print error message to log
287 SectionEnd ; end of GTK+ section
289 ;--------------------------------
290 ;Pidgin Install Section
292 Section $(PIDGINSECTIONTITLE
) SecPidgin
295 ; Check install rights..
296 Call CheckUserInstallRights
299 StrCmp $R0 "NONE" pidgin_install_files
300 StrCmp $R0 "HKLM" pidgin_hklm pidgin_hkcu
303 WriteRegStr HKLM "${HKLM_APP_PATHS_KEY}" "" "$INSTDIR\pidgin.exe"
304 WriteRegStr HKLM "${HKLM_APP_PATHS_KEY}" "Path" "$INSTDIR\Gtk\bin"
305 WriteRegStr HKLM ${PIDGIN_REG_KEY} "" "$INSTDIR"
306 WriteRegStr HKLM ${PIDGIN_REG_KEY} "Version" "${PIDGIN_VERSION}"
307 WriteRegStr HKLM "${PIDGIN_UNINSTALL_KEY}" "DisplayIcon" "$INSTDIR\pidgin.exe"
308 WriteRegStr HKLM "${PIDGIN_UNINSTALL_KEY}" "DisplayName" "Pidgin"
309 WriteRegStr HKLM "${PIDGIN_UNINSTALL_KEY}" "DisplayVersion" "${PIDGIN_VERSION}"
310 WriteRegStr HKLM "${PIDGIN_UNINSTALL_KEY}" "HelpLink" "http://developer.pidgin.im/wiki/Using Pidgin"
311 WriteRegDWORD HKLM "${PIDGIN_UNINSTALL_KEY}" "NoModify" 1
312 WriteRegDWORD HKLM "${PIDGIN_UNINSTALL_KEY}" "NoRepair" 1
313 WriteRegStr HKLM "${PIDGIN_UNINSTALL_KEY}" "UninstallString" "$INSTDIR\${PIDGIN_UNINST_EXE}"
314 ; Sets scope of the desktop and Start Menu entries for all users.
315 SetShellVarContext
"all"
316 Goto pidgin_install_files
319 WriteRegStr HKCU ${PIDGIN_REG_KEY} "" "$INSTDIR"
320 WriteRegStr HKCU ${PIDGIN_REG_KEY} "Version" "${PIDGIN_VERSION}"
321 WriteRegStr HKCU "${PIDGIN_UNINSTALL_KEY}" "DisplayIcon" "$INSTDIR\pidgin.exe"
322 WriteRegStr HKCU "${PIDGIN_UNINSTALL_KEY}" "DisplayName" "Pidgin"
323 WriteRegStr HKCU "${PIDGIN_UNINSTALL_KEY}" "DisplayVersion" "${PIDGIN_VERSION}"
324 WriteRegStr HKCU "${PIDGIN_UNINSTALL_KEY}" "HelpLink" "http://developer.pidgin.im/wiki/Using Pidgin"
325 WriteRegDWORD HKCU "${PIDGIN_UNINSTALL_KEY}" "NoModify" 1
326 WriteRegDWORD HKCU "${PIDGIN_UNINSTALL_KEY}" "NoRepair" 1
327 WriteRegStr HKCU "${PIDGIN_UNINSTALL_KEY}" "UninstallString" "$INSTDIR\${PIDGIN_UNINST_EXE}"
328 Goto pidgin_install_files
330 pidgin_install_files:
331 SetOutPath "$INSTDIR"
335 ;Delete old liboscar and libjabber since they tend to be problematic
336 Delete "$INSTDIR\plugins\liboscar.dll"
337 Delete "$INSTDIR\plugins\libjabber.dll"
339 File /r
/x locale
..\
..\
..\
${PIDGIN_INSTALL_DIR}\
*.*
341 ; Check if Perl is installed, if so add it to the AppPaths
342 ReadRegStr $R2 HKLM ${PERL_REG_KEY} ""
343 StrCmp $R2 "" 0 perl_exists
344 ReadRegStr $R2 HKCU ${PERL_REG_KEY} ""
345 StrCmp $R2 "" perl_done perl_exists
348 IfFileExists "$R2\bin\${PERL_DLL}" 0 perl_done
349 StrCmp $R0 "HKLM" 0 perl_done
350 ReadRegStr $R3 HKLM "${HKLM_APP_PATHS_KEY}" "Path"
351 WriteRegStr HKLM "${HKLM_APP_PATHS_KEY}" "Path" "$R3;$R2\bin"
355 ; If this is under NT4, delete the SILC support stuff
356 ; there is a bug that will prevent any account from connecting
357 ; See https://lists.silcnet.org/pipermail/silc-devel/2005-January/001588.html
358 ; Also, remove the GSSAPI SASL plugin and associated files as they aren't
359 ; compatible with NT4.
363 Delete "$INSTDIR\plugins\libsilc.dll"
364 Delete "$INSTDIR\libsilcclient-1-1-2.dll"
365 Delete "$INSTDIR\libsilc-1-1-2.dll"
367 Delete "$INSTDIR\sasl2\saslGSSAPI.dll"
370 SetOutPath "$INSTDIR"
372 ; If we don't have install rights we're done
373 StrCmp $R0 "NONE" done
376 ; write out uninstaller
378 WriteUninstaller "$INSTDIR\${PIDGIN_UNINST_EXE}"
381 ; If we previously had pidgin set up to run on startup, make it do so again
382 StrCmp $STARTUP_RUN_KEY "HKCU" +1 +2
383 WriteRegStr HKCU "${STARTUP_RUN_KEY}" "Pidgin" "$INSTDIR\pidgin.exe"
384 StrCmp $STARTUP_RUN_KEY "HKLM" +1 +2
385 WriteRegStr HKLM "${STARTUP_RUN_KEY}" "Pidgin" "$INSTDIR\pidgin.exe"
388 SectionEnd ; end of default Pidgin section
390 ;--------------------------------
393 SectionGroup
/e
$(PIDGINSHORTCUTSSECTIONTITLE
) SecShortcuts
394 Section /o
$(PIDGINDESKTOPSHORTCUTSECTIONTITLE
) SecDesktopShortcut
396 CreateShortCut "$DESKTOP\Pidgin.lnk" "$INSTDIR\pidgin.exe"
399 Section $(PIDGINSTARTMENUSHORTCUTSECTIONTITLE
) SecStartMenuShortcut
401 CreateShortCut "$SMPROGRAMS\Pidgin.lnk" "$INSTDIR\pidgin.exe"
406 ;--------------------------------
409 !macro URI_SECTION proto
410 Section /o
"${proto}:" SecURI_
${proto}
412 Call RegisterURIHandler
415 SectionGroup
/e
$(URIHANDLERSSECTIONTITLE
) SecURIHandlers
416 !insertmacro URI_SECTION
"aim"
417 !insertmacro URI_SECTION
"msnim"
418 !insertmacro URI_SECTION
"myim"
419 !insertmacro URI_SECTION
"ymsgr"
420 !insertmacro URI_SECTION
"xmpp"
423 ;--------------------------------
426 !macro LANG_SECTION lang
427 ${MementoUnselectedSection} "${lang}" SecLang_
${lang}
428 SetOutPath "$INSTDIR\locale\${lang}\LC_MESSAGES"
429 File "..\..\..\${PIDGIN_INSTALL_DIR}\locale\${lang}\LC_MESSAGES\*.mo"
430 SetOutPath "$INSTDIR"
433 SectionGroup
$(TRANSLATIONSSECTIONTITLE
) SecTranslations
434 # pidgin-translations is generated based on the contents of the locale directory
435 !include "pidgin-translations.nsh"
437 ${MementoSectionDone}
439 ;--------------------------------
442 !macro SPELLCHECK_SECTION lang lang_name lang_file
443 Section /o
"${lang_name}" SecSpell_
${lang}
449 SectionGroup
$(PIDGINSPELLCHECKSECTIONTITLE
) SecSpellCheck
450 !include "pidgin-spellcheck.nsh"
453 Section /o
$(DEBUGSYMBOLSSECTIONTITLE
) SecDebugSymbols
456 StrCpy $R1 "$PLUGINSDIR\dbgsym.zip"
457 !ifdef OFFLINE_INSTALLER
459 SetOutPath $PLUGINSDIR
460 File /oname=dbgsym
.zip
"..\..\..\pidgin-${PIDGIN_VERSION}-dbgsym.zip"
464 ; We need to download the debug symbols
466 StrCpy $R2 "${DOWNLOADER_URL}?version=${PIDGIN_VERSION}&dl_pkg=dbgsym"
467 DetailPrint "Downloading Debug Symbols... ($R2)"
468 NSISdl::download
/TIMEOUT=
10000 $R2 $R1
470 StrCmp $R0 "cancel" done
471 StrCmp $R0 "success" +2
472 MessageBox MB_RETRYCANCEL "$(PIDGINDEBUGSYMBOLSERROR)" /SD
IDCANCEL IDRETRY retry
IDCANCEL done
476 SetOutPath "$INSTDIR"
477 nsisunz::UnzipToLog
$R1 "$INSTDIR"
479 StrCmp $R0 "success" +2
480 DetailPrint "$R0" ;print error message to log
485 ;--------------------------------
490 Call un
.CheckUserInstallRights
492 StrCmp $R0 "NONE" no_rights
493 StrCmp $R0 "HKCU" try_hkcu try_hklm
496 ReadRegStr $R0 HKCU ${PIDGIN_REG_KEY} ""
497 StrCmp $R0 $INSTDIR 0 cant_uninstall
498 ; HKCU install path matches our INSTDIR so uninstall
499 DeleteRegKey HKCU ${PIDGIN_REG_KEY}
500 DeleteRegKey HKCU "${PIDGIN_UNINSTALL_KEY}"
504 ReadRegStr $R0 HKLM ${PIDGIN_REG_KEY} ""
505 StrCmp $R0 $INSTDIR 0 try_hkcu
506 ; HKLM install path matches our INSTDIR so uninstall
507 DeleteRegKey HKLM ${PIDGIN_REG_KEY}
508 DeleteRegKey HKLM "${PIDGIN_UNINSTALL_KEY}"
509 DeleteRegKey HKLM "${HKLM_APP_PATHS_KEY}"
510 ; Sets start menu and desktop scope to all users..
511 SetShellVarContext
"all"
514 ; The WinPrefs plugin may have left this behind..
515 DeleteRegValue HKCU "${STARTUP_RUN_KEY}" "Pidgin"
516 DeleteRegValue HKLM "${STARTUP_RUN_KEY}" "Pidgin"
517 ; Remove Language preference info
518 DeleteRegValue HKCU "${PIDGIN_REG_KEY}" "${MUI_LANGDLL_REGISTRY_VALUENAME}"
520 ; Remove any URI handlers
521 ; I can't think of an easy way to maintain a list in a single place
523 Call un
.UnregisterURIHandler
525 Call un
.UnregisterURIHandler
527 Call un
.UnregisterURIHandler
529 Call un
.UnregisterURIHandler
531 Call un
.UnregisterURIHandler
533 Delete "$INSTDIR\ca-certs\AddTrust_External_Root.pem"
534 Delete "$INSTDIR\ca-certs\America_Online_Root_Certification_Authority_1.pem"
535 Delete "$INSTDIR\ca-certs\AOL_Member_CA.pem"
536 Delete "$INSTDIR\ca-certs\CAcert_Class3.pem"
537 Delete "$INSTDIR\ca-certs\CAcert_Root.pem"
538 Delete "$INSTDIR\ca-certs\Deutsche_Telekom_Root_CA_2.pem"
539 Delete "$INSTDIR\ca-certs\DigiCertHighAssuranceCA-3.pem"
540 Delete "$INSTDIR\ca-certs\Entrust.net_Secure_Server_CA.pem"
541 Delete "$INSTDIR\ca-certs\Equifax_Secure_CA.pem"
542 Delete "$INSTDIR\ca-certs\Equifax_Secure_Global_eBusiness_CA-1.pem"
543 Delete "$INSTDIR\ca-certs\Go_Daddy_Class_2_CA.pem"
544 Delete "$INSTDIR\ca-certs\GTE_CyberTrust_Global_Root.pem"
545 Delete "$INSTDIR\ca-certs\Microsoft_Internet_Authority.pem"
546 Delete "$INSTDIR\ca-certs\Microsoft_Internet_Authority_2010.pem"
547 Delete "$INSTDIR\ca-certs\Microsoft_Secure_Server_Authority.pem"
548 Delete "$INSTDIR\ca-certs\Microsoft_Secure_Server_Authority_2010.pem"
549 Delete "$INSTDIR\ca-certs\StartCom_Certification_Authority.pem"
550 Delete "$INSTDIR\ca-certs\StartCom_Free_SSL_CA.pem"
551 Delete "$INSTDIR\ca-certs\Thawte_Premium_Server_CA.pem"
552 Delete "$INSTDIR\ca-certs\Thawte_Primary_Root_CA.pem"
553 Delete "$INSTDIR\ca-certs\ValiCert_Class_2_VA.crt"
554 Delete "$INSTDIR\ca-certs\VeriSign_Class3_Extended_Validation_CA.pem"
555 Delete "$INSTDIR\ca-certs\Verisign_Class3_Primary_CA.pem"
556 Delete "$INSTDIR\ca-certs\VeriSign_Class_3_Public_Primary_Certification_Authority_-_G2.pem"
557 Delete "$INSTDIR\ca-certs\VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem"
558 Delete "$INSTDIR\ca-certs\VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5_2.pem"
559 Delete "$INSTDIR\ca-certs\VeriSign_International_Server_Class_3_CA.pem"
560 Delete "$INSTDIR\ca-certs\Verisign_RSA_Secure_Server_CA.pem"
561 RMDir "$INSTDIR\ca-certs"
562 RMDir /r
"$INSTDIR\locale"
563 RMDir /r
"$INSTDIR\pixmaps"
564 Delete "$INSTDIR\plugins\autoaccept.dll"
565 Delete "$INSTDIR\plugins\buddynote.dll"
566 Delete "$INSTDIR\plugins\convcolors.dll"
567 Delete "$INSTDIR\plugins\extplacement.dll"
568 Delete "$INSTDIR\plugins\gtkbuddynote.dll"
569 Delete "$INSTDIR\plugins\history.dll"
570 Delete "$INSTDIR\plugins\iconaway.dll"
571 Delete "$INSTDIR\plugins\idle.dll"
572 Delete "$INSTDIR\plugins\joinpart.dll"
573 Delete "$INSTDIR\plugins\libaim.dll"
574 Delete "$INSTDIR\plugins\libbonjour.dll"
575 Delete "$INSTDIR\plugins\libgg.dll"
576 Delete "$INSTDIR\plugins\libicq.dll"
577 Delete "$INSTDIR\plugins\libirc.dll"
578 Delete "$INSTDIR\plugins\libmsn.dll"
579 Delete "$INSTDIR\plugins\libmxit.dll"
580 Delete "$INSTDIR\plugins\libmyspace.dll"
581 Delete "$INSTDIR\plugins\libnapster.dll"
582 Delete "$INSTDIR\plugins\libnovell.dll"
583 Delete "$INSTDIR\plugins\libsametime.dll"
584 Delete "$INSTDIR\plugins\libsilc.dll"
585 Delete "$INSTDIR\plugins\libsimple.dll"
586 Delete "$INSTDIR\plugins\libtoc.dll"
587 Delete "$INSTDIR\plugins\libyahoo.dll"
588 Delete "$INSTDIR\plugins\libyahoojp.dll"
589 Delete "$INSTDIR\plugins\libxmpp.dll"
590 Delete "$INSTDIR\plugins\log_reader.dll"
591 Delete "$INSTDIR\plugins\markerline.dll"
592 Delete "$INSTDIR\plugins\newline.dll"
593 Delete "$INSTDIR\plugins\notify.dll"
594 Delete "$INSTDIR\plugins\offlinemsg.dll"
595 Delete "$INSTDIR\plugins\perl.dll"
596 Delete "$INSTDIR\plugins\pidginrc.dll"
597 Delete "$INSTDIR\plugins\psychic.dll"
598 Delete "$INSTDIR\plugins\relnot.dll"
599 Delete "$INSTDIR\plugins\sendbutton.dll"
600 Delete "$INSTDIR\plugins\spellchk.dll"
601 Delete "$INSTDIR\plugins\ssl-nss.dll"
602 Delete "$INSTDIR\plugins\ssl.dll"
603 Delete "$INSTDIR\plugins\statenotify.dll"
604 Delete "$INSTDIR\plugins\tcl.dll"
605 Delete "$INSTDIR\plugins\themeedit.dll"
606 Delete "$INSTDIR\plugins\ticker.dll"
607 Delete "$INSTDIR\plugins\timestamp.dll"
608 Delete "$INSTDIR\plugins\timestamp_format.dll"
609 Delete "$INSTDIR\plugins\win2ktrans.dll"
610 Delete "$INSTDIR\plugins\winprefs.dll"
611 Delete "$INSTDIR\plugins\xmppconsole.dll"
612 Delete "$INSTDIR\plugins\xmppdisco.dll"
613 RMDir /r
"$INSTDIR\plugins\perl"
614 RMDir "$INSTDIR\plugins"
615 RMDir /r
"$INSTDIR\sasl2"
616 Delete "$INSTDIR\sounds\purple\alert.wav"
617 Delete "$INSTDIR\sounds\purple\login.wav"
618 Delete "$INSTDIR\sounds\purple\logout.wav"
619 Delete "$INSTDIR\sounds\purple\receive.wav"
620 Delete "$INSTDIR\sounds\purple\send.wav"
621 RMDir "$INSTDIR\sounds\purple"
622 RMDir "$INSTDIR\sounds"
623 Delete "$INSTDIR\spellcheck\libenchant.dll"
624 Delete "$INSTDIR\spellcheck\libgtkspell-0.dll"
625 Delete "$INSTDIR\spellcheck\lib\enchant\libenchant_aspell.dll"
626 Delete "$INSTDIR\spellcheck\lib\enchant\libenchant_ispell.dll"
627 Delete "$INSTDIR\spellcheck\lib\enchant\libenchant_myspell.dll"
628 RMDir "$INSTDIR\spellcheck\lib\enchant"
629 RMDir "$INSTDIR\spellcheck\lib"
630 RMDir "$INSTDIR\spellcheck"
631 Delete "$INSTDIR\freebl3.dll"
632 Delete "$INSTDIR\libjabber.dll"
633 Delete "$INSTDIR\libnspr4.dll"
634 Delete "$INSTDIR\libmeanwhile-1.dll"
635 Delete "$INSTDIR\liboscar.dll"
636 Delete "$INSTDIR\libplc4.dll"
637 Delete "$INSTDIR\libplds4.dll"
638 Delete "$INSTDIR\libpurple.dll"
639 Delete "$INSTDIR\libsasl.dll"
640 Delete "$INSTDIR\libsilc-1-1-2.dll"
641 Delete "$INSTDIR\libsilcclient-1-1-2.dll"
642 Delete "$INSTDIR\libxml2-2.dll"
643 Delete "$INSTDIR\libymsg.dll"
644 Delete "$INSTDIR\nss3.dll"
645 Delete "$INSTDIR\nssutil3.dll"
646 Delete "$INSTDIR\nssckbi.dll"
647 Delete "$INSTDIR\pidgin.dll"
648 Delete "$INSTDIR\pidgin.exe"
649 Delete "$INSTDIR\smime3.dll"
650 Delete "$INSTDIR\softokn3.dll"
651 Delete "$INSTDIR\sqlite3.dll"
652 Delete "$INSTDIR\ssl3.dll"
653 Delete "$INSTDIR\${PIDGIN_UNINST_EXE}"
654 Delete "$INSTDIR\exchndl.dll"
655 Delete "$INSTDIR\install.log"
657 ; Remove the debug symbols
658 RMDir /r
"$INSTDIR\pidgin-${PIDGIN_VERSION}-dbgsym"
660 ; Remove the local GTK+ copy (if we're not just upgrading)
663 ${GetOptions} "$R0" "/UPGRADE=" $R1
665 StrCmp $R1 "1" upgrade_done
666 RMDir /r
"$INSTDIR\Gtk"
667 ; Remove the downloaded spellcheck dictionaries (if we're not just upgrading)
668 RMDir /r
"$INSTDIR\spellcheck"
671 ;Try to remove Pidgin install dir (only if empty)
675 Delete "$DESKTOP\Pidgin.lnk"
676 Delete "$SMPROGRAMS\Pidgin.lnk"
681 MessageBox MB_OK $(PIDGINUNINSTALLERROR1
) /SD
IDOK
685 MessageBox MB_OK $(PIDGINUNINSTALLERROR2
) /SD
IDOK
689 SectionEnd ; end of uninstall section
691 ;--------------------------------
693 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
694 !insertmacro MUI_DESCRIPTION_TEXT
${SecPidgin} \
695 $(PIDGINSECTIONDESCRIPTION
)
696 !insertmacro MUI_DESCRIPTION_TEXT
${SecGtk} \
697 $(GTKSECTIONDESCRIPTION
)
699 !insertmacro MUI_DESCRIPTION_TEXT
${SecShortcuts} \
700 $(PIDGINSHORTCUTSSECTIONDESCRIPTION
)
701 !insertmacro MUI_DESCRIPTION_TEXT
${SecDesktopShortcut} \
702 $(PIDGINDESKTOPSHORTCUTDESC
)
703 !insertmacro MUI_DESCRIPTION_TEXT
${SecStartMenuShortcut} \
704 $(PIDGINSTARTMENUSHORTCUTDESC
)
706 !insertmacro MUI_DESCRIPTION_TEXT
${SecSpellCheck} \
707 $(PIDGINSPELLCHECKSECTIONDESCRIPTION
)
709 !insertmacro MUI_FUNCTION_DESCRIPTION_END
711 ;--------------------------------
714 ; Default the URI handler checkboxes if Pidgin is the current handler or if there is no handler
715 Function SelectURIHandlerSelections
721 ; Start with the first URI handler
722 IntOp $R0 ${SecURIHandlers} + 1
725 ; If it is the end of the section group, stop
726 SectionGetFlags
$R0 $R1
727 IntOp $R2 $R1 & ${SF_SECGRPEND}
728 IntCmp $R2 ${SF_SECGRPEND} done
730 SectionGetText
$R0 $R2
731 ;Strip the trailing ':'
737 ReadRegStr $R3 HKCR "$R2" ""
738 IfErrors default_on
;there is no current handler
741 Call CheckIfPidginIsCurrentURIHandler
744 ; If Pidgin isn't the current handler, we don't steal it automatically
745 IntCmp $R3 0 end_loop
747 ;We default the URI handler checkbox on
749 IntOp $R1 $R1 |
${SF_SELECTED} ; Select
750 SectionSetFlags
$R0 $R1
753 IntOp $R0 $R0 + 1 ;Advance to the next section
761 FunctionEnd ;SelectURIHandlerSections
763 ; Check if Pidgin is the current handler
764 ; Returns a boolean on the stack
765 !macro CheckIfPidginIsCurrentURIHandlerMacro UN
766 Function ${UN}CheckIfPidginIsCurrentURIHandler
770 ReadRegStr $R0 HKCR "$R0\shell\Open\command" ""
776 ${un
.WordFind
} "$R0" "pidgin.exe" "E+1{" $R0
778 ${WordFind} "$R0" "pidgin.exe" "E+1{" $R0
788 !insertmacro CheckIfPidginIsCurrentURIHandlerMacro
""
789 !insertmacro CheckIfPidginIsCurrentURIHandlerMacro
"un."
791 ; If Pidgin is the current URI handler for the specified protocol, remove it.
792 Function un
.UnregisterURIHandler
797 Call un
.CheckIfPidginIsCurrentURIHandler
800 ; If Pidgin isn't the current handler, leave it as-is
803 ;Unregister the URI handler
804 DetailPrint "Unregistering $R0 URI Handler"
805 DeleteRegKey HKCR "$R0"
812 Function RegisterURIHandler
814 DetailPrint "Registering $R0 URI Handler"
815 DeleteRegKey HKCR "$R0"
816 WriteRegStr HKCR "$R0" "" "URL:$R0"
817 WriteRegStr HKCR "$R0" "URL Protocol" ""
818 WriteRegStr HKCR "$R0\DefaultIcon" "" "$INSTDIR\pidgin.exe"
819 WriteRegStr HKCR "$R0\shell" "" ""
820 WriteRegStr HKCR "$R0\shell\Open" "" ""
821 WriteRegStr HKCR "$R0\shell\Open\command" "" "$INSTDIR\pidgin.exe --protocolhandler=%1"
826 !macro CheckUserInstallRightsMacro UN
827 Function ${UN}CheckUserInstallRights
834 UserInfo::GetAccountType
837 StrCmp $1 "Admin" 0 +3
840 StrCmp $1 "Power" 0 +3
843 StrCmp $1 "User" 0 +3
846 StrCmp $1 "Guest" 0 +3
862 !insertmacro CheckUserInstallRightsMacro
""
863 !insertmacro CheckUserInstallRightsMacro
"un."
867 ; Push $0 ; Path string
869 ; Pop $0 ; 0 - Bad path 1 - Good path
876 IfFileExists $0 dir_exists
877 StrCpy $1 $0 ; save last
880 ; IfFileExists "C:" on xp returns true and on win2k returns false
881 ; So we're done in such a case..
882 IntCmp $2 2 loop_done
883 ; GetParent of "C:" returns ""
884 IntCmp $2 0 loop_done
888 StrCpy $1 "$0\GaImFooB"
889 ; Check if we can create dir on this drive..
892 IfErrors DirBad DirGood
896 FileOpen $1 "$0\pidginfoo.bar" w
897 IfErrors PathBad PathGood
909 Delete "$0\pidginfoo.bar"
917 Delete "$0\pidginfoo.bar"
923 Exch 3 ; The top of the stack contains the output variable
929 Function .onVerifyInstDir
934 StrCmp $0 "0" 0 dir_good
946 ; 0 - We have the correct version
947 ; 1 - We have an old version that should work, prompt user for optional upgrade
948 ; 2 - We have an old version that needs to be upgraded
949 ; 3 - We don't have Gtk+ at all
955 IfFileExists "$INSTDIR\Gtk\CONTENTS" +3
960 ${ConfigRead} "$INSTDIR\Gtk\CONTENTS" "Bundle Version " $0
965 ${VersionCompare} ${GTK_INSTALL_VERSION} $0 $1
967 Push "0" ; Have a good version
970 ${VersionCompare} ${GTK_MIN_VERSION} $0 $1
972 Push "1" ; Optional Upgrade
974 Push "2" ; Mandatory Upgrade
978 ; The item on the stack is what we want to return
986 !macro RunCheckMacro UN
987 Function ${UN}RunCheck
993 ; Close the Handle (needed if we're retrying)
995 System::Call 'kernel32::CloseHandle(i $R1) i .R1'
996 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "pidgin_is_running") i .R1 ?e'
998 IntCmp $R0 0 +3 ;This could check for ERROR_ALREADY_EXISTS(183), but lets just assume
999 MessageBox MB_RETRYCANCEL|
MB_ICONEXCLAMATION $(PIDGINISRUNNING
) /SD
IDCANCEL IDRETRY retry_runcheck
1002 ; Close the Handle (If we don't do this, the uninstaller called from within will fail)
1003 ; This is not optimal because there is a (small) window of time when a new process could start
1004 System::Call 'kernel32::CloseHandle(i $R1) i .R1'
1010 !insertmacro RunCheckMacro
""
1011 !insertmacro RunCheckMacro
"un."
1017 Push $R3 ; This is only used for the Parameters throughout the function
1019 ${GetParameters} $R3
1023 ; Close the Handle (needed if we're retrying)
1025 System::Call 'kernel32::CloseHandle(i $R1) i .R1'
1026 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "pidgin_installer_running") i .R1 ?e'
1028 IntCmp $R0 0 +3 ;This could check for ERROR_ALREADY_EXISTS(183), but lets just assume
1029 MessageBox MB_RETRYCANCEL|
MB_ICONEXCLAMATION $(INSTALLERISRUNNING
) /SD
IDCANCEL IDRETRY retry_runcheck
1032 ; Allow installer to run even if pidgin is running via "/NOPIDGINRUNCHECK=1"
1033 ; This is useful for testing
1035 ${GetOptions} "$R3" "/NOPIDGINRUNCHECK=" $R1
1039 StrCpy $name "Pidgin ${PIDGIN_VERSION}"
1041 ;Try to copy the old Gaim installer Lang Reg. key
1042 ;(remove it after we're done to prevent this being done more than once)
1044 ReadRegStr $R0 HKCU "${PIDGIN_REG_KEY}" "${MUI_LANGDLL_REGISTRY_VALUENAME}"
1047 ReadRegStr $R0 HKCU "${OLD_GAIM_REG_KEY}" "${MUI_LANGDLL_REGISTRY_VALUENAME}"
1049 DeleteRegValue HKCU "${OLD_GAIM_REG_KEY}" "${MUI_LANGDLL_REGISTRY_VALUENAME}"
1050 WriteRegStr HKCU "${PIDGIN_REG_KEY}" "${MUI_LANGDLL_REGISTRY_VALUENAME}" "$R0"
1052 ${MementoSectionRestore}
1054 ;Preselect the URI handlers as appropriate
1055 Call SelectURIHandlerSelections
1057 ;Preselect the "shortcuts" checkboxes according to the previous installation
1059 ;Make sure that there was a previous installation
1060 ReadRegStr $R0 HKCU "${PIDGIN_REG_KEY}" "${MUI_LANGDLL_REGISTRY_VALUENAME}"
1061 IfErrors done_preselecting_shortcuts
1062 ;Does the Desktop shortcut exist?
1063 GetFileTime "$DESKTOP\Pidgin.lnk" $R0 $R0
1066 SetShellVarContext
"all"
1067 GetFileTime "$DESKTOP\Pidgin.lnk" $R0 $R0
1068 IfErrors preselect_startmenu_shortcut
;Desktop Shortcut if off by default
1069 !insertmacro SelectSection
${SecDesktopShortcut}
1070 preselect_startmenu_shortcut:
1071 ;Reset ShellVarContext because we may have changed it
1072 SetShellVarContext
"current"
1074 ;Does the StartMenu shortcut exist?
1075 GetFileTime "$SMPROGRAMS\Pidgin.lnk" $R0 $R0
1076 IfErrors +1 done_preselecting_shortcuts
;StartMenu Shortcut is on by default
1078 SetShellVarContext
"all"
1079 GetFileTime "$SMPROGRAMS\Pidgin.lnk" $R0 $R0
1080 IfErrors +1 done_preselecting_shortcuts
;StartMenu Shortcut is on by default
1081 !insertmacro UnselectSection
${SecStartMenuShortcut}
1082 done_preselecting_shortcuts:
1083 ;Reset ShellVarContext because we may have changed it
1084 SetShellVarContext
"current"
1087 ${GetOptions} "$R3" "/L=" $R1
1089 StrCpy $LANGUAGE $R1
1093 ; Display Language selection dialog
1094 !define MUI_LANGDLL_ALWAYSSHOW
1095 !insertmacro MUI_LANGDLL_DISPLAY
1099 ${GetOptions} "$R3" "/DS=" $R1
1101 SectionGetFlags
${SecDesktopShortcut} $R2
1103 IntOp $R2 $R2 |
${SF_SELECTED}
1105 IntOp $R1 ${SF_SELECTED} ~
1107 SectionSetFlags
${SecDesktopShortcut} $R2
1110 ${GetOptions} "$R3" "/SMS=" $R1
1112 SectionGetFlags
${SecStartMenuShortcut} $R2
1114 IntOp $R2 $R2 |
${SF_SELECTED}
1116 IntOp $R1 ${SF_SELECTED} ~
1118 SectionSetFlags
${SecStartMenuShortcut} $R2
1120 ; If install path was set on the command, use it.
1121 StrCmp $INSTDIR "" 0 instdir_done
1123 ; If pidgin or gaim is currently installed, we should default to where it is currently installed
1125 ReadRegStr $INSTDIR HKCU "${PIDGIN_REG_KEY}" ""
1127 StrCmp $INSTDIR "" 0 instdir_done
1129 ReadRegStr $INSTDIR HKLM "${PIDGIN_REG_KEY}" ""
1131 StrCmp $INSTDIR "" 0 instdir_done
1133 Call CheckUserInstallRights
1136 StrCmp $R0 "HKLM" 0 user_dir
1137 StrCpy $INSTDIR "$PROGRAMFILES\Pidgin"
1141 ${GetParent} $SMPROGRAMS $R2
1142 ${GetParent} $R2 $R2
1143 StrCpy $INSTDIR "$R2\Pidgin"
1148 ; Try to select a translation and a dictionary for the currently selected Language
1149 Call SelectTranslationForCurrentLanguage
1151 ;Mark the dictionaries that are already installed as readonly
1152 Call SelectAndDisableInstalledDictionaries
1160 Function .onInstSuccess
1162 ${MementoSectionSave}
1170 StrCpy $name "Pidgin ${PIDGIN_VERSION}"
1173 ; Get stored language preference
1174 !insertmacro MUI_UNGETLANGUAGE
1178 ; Page enter and exit functions..
1180 Function preWelcomePage
1184 !ifdef OFFLINE_INSTALLER
1185 !insertmacro SelectSection
${SecDebugSymbols}
1189 Pop $CURRENT_GTK_STATE
1190 StrCpy $WARNED_GTK_STATE "0"
1191 IntCmp $CURRENT_GTK_STATE 1 done gtk_not_mandatory
1192 ; Make the GTK+ Section RO if it is required. (it is required only if you have an existing version that is too old)
1193 StrCmp $CURRENT_GTK_STATE "2" 0 done
1194 !insertmacro SetSectionFlag
${SecGtk} ${SF_RO}
1197 ; Don't select the GTK+ section if we already have this version or newer installed
1198 !insertmacro UnselectSection
${SecGtk}
1205 ; If the GTK+ Section has been unselected and there isn't a compatible GTK+ already, confirm
1206 Function .onSelChange
1209 SectionGetFlags
${SecGtk} $R0
1210 IntOp $R0 $R0 & ${SF_SELECTED}
1211 ; If the Gtk Section is currently selected, reset the "Warned" flag
1212 StrCmp $R0 "${SF_SELECTED}" 0 +3
1213 StrCpy $WARNED_GTK_STATE "0"
1216 ; If we've already warned the user, don't warn them again
1217 StrCmp $WARNED_GTK_STATE "1" done
1218 IntCmp $CURRENT_GTK_STATE 1 done done
0
1219 StrCpy $WARNED_GTK_STATE "1"
1220 MessageBox MB_YESNO $(PIDGINPROMPTFORCENOGTK
) /SD
IDNO IDYES done
1221 !insertmacro SelectSection
${SecGtk}
1227 Function SelectTranslationForCurrentLanguage
1228 !insertmacro SELECT_TRANSLATION_FUNCTION
1231 ; SpellChecker Related Functions
1232 ;-------------------------------
1234 ; Select and Disable any Sections that have currently installed dictionaries
1235 !macro CHECK_SPELLCHECK_SECTION lang
1236 ;Advance to the next (correct) section index
1238 IfFileExists "$INSTDIR\spellcheck\share\enchant\myspell\${lang}.dic" 0 done_
${lang}
1239 SectionGetFlags
$R0 $R1
1240 IntOp $R1 $R1 |
${SF_RO} ; Mark Readonly
1241 IntOp $R1 $R1 |
${SF_SELECTED} ; Select
1242 SectionSetFlags
$R0 $R1
1245 Function SelectAndDisableInstalledDictionaries
1249 !insertmacro SetSectionFlag
${SecSpellCheck} ${SF_RO}
1250 !insertmacro UnselectSection
${SecSpellCheck}
1252 IntOp $R0 ${SecSpellCheck} + 0
1253 !include "pidgin-spellcheck-preselect.nsh"
1259 Function InstallDict
1262 Pop $R0 ;This is the language code
1265 Pop $R1 ;This is the language file
1271 IfFileExists "$INSTDIR\spellcheck\share\enchant\myspell\$R0.dic" installed
1275 ; We need to download and install dictionary
1276 StrCpy $R2 "$PLUGINSDIR\$R1"
1277 StrCpy $R3 "${SPELL_DOWNLOAD_URL}/$R1"
1278 DetailPrint "Downloading the $R0 Dictionary... ($R3)"
1280 NSISdl::download
/TIMEOUT=
10000 "$R3" "$R2"
1282 StrCmp $R4 "cancel" done
1283 StrCmp $R4 "success" +3
1284 MessageBox MB_RETRYCANCEL "$(PIDGINSPELLCHECKERROR)" /SD
IDCANCEL IDRETRY retry
IDCANCEL done
1286 SetOutPath "$INSTDIR\spellcheck\share\enchant\myspell"
1287 nsisunz::UnzipToLog
"$R2" "$OUTDIR"
1288 SetOutPath "$INSTDIR"
1290 StrCmp $R3 "success" installed
1291 DetailPrint "$R3" ;print error message to log
1294 installed: ;The dictionary is currently installed, no error message
1295 DetailPrint "$R0 Dictionary is installed"