Dutch translation updated (Gideon van Melle)
[pidgin-git.git] / pidgin / win32 / nsis / pidgin-installer.nsi
blobbac9d1224271616a1dd36a6dff4b807f62663ac0
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 ;--------------------------------
9 ;Global Variables
10 Var name
11 Var STARTUP_RUN_KEY
12 Var CURRENT_GTK_STATE
13 Var WARNED_GTK_STATE
15 ;--------------------------------
16 ;Configuration
18 ;The name var is set in .onInit
19 Name $name
21 !ifdef OFFLINE_INSTALLER
22 OutFile "pidgin-${PIDGIN_VERSION}-offline.exe"
23 !else
24 OutFile "pidgin-${PIDGIN_VERSION}.exe"
25 !endif
27 SetCompressor /SOLID lzma
28 ShowInstDetails show
29 ShowUninstDetails show
30 SetDateSave on
31 RequestExecutionLevel highest
33 ; $name and $INSTDIR are set in .onInit function..
35 !include "MUI.nsh"
36 !include "Sections.nsh"
37 !include "WinVer.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
48 !insertmacro WordFind
49 !insertmacro un.WordFind
51 !include "TextFunc.nsh"
53 ;--------------------------------
54 ;Defines
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 ;--------------------------------
81 ;Version resource
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)"
89 !else
90 VIAddVersionKey "FileDescription" "Pidgin Installer"
91 !endif
93 ;--------------------------------
94 ;Reserve files used in .onInit
95 ;for faster start-up
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
120 ;Finish Page config
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 ;--------------------------------
128 ;Pages
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 ;--------------------------------
147 ;Languages
149 !include "${PIDGIN_NSIS_INCLUDE_PATH}\langmacros.nsh"
151 ;--------------------------------
152 ;Reserve Files
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
170 Pop $R0
172 ;First try to uninstall Pidgin
173 StrCpy $R4 ${PIDGIN_REG_KEY}
174 StrCpy $R5 ${PIDGIN_UNINSTALL_KEY}
175 StrCpy $R6 ${PIDGIN_UNINST_EXE}
176 StrCpy $R7 "Pidgin"
178 start_comparison:
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
182 ClearErrors
183 ReadRegStr $STARTUP_RUN_KEY HKCU "${STARTUP_RUN_KEY}" $R7
184 IfErrors +3
185 StrCpy $STARTUP_RUN_KEY "HKCU"
186 Goto +5
187 ClearErrors
188 ReadRegStr $STARTUP_RUN_KEY HKLM "${STARTUP_RUN_KEY}" $R7
189 IfErrors +2
190 StrCpy $STARTUP_RUN_KEY "HKLM"
192 StrCmp $R0 "HKLM" compare_hklm
193 StrCmp $R0 "HKCU" compare_hkcu done
195 compare_hkcu:
196 ReadRegStr $R1 HKCU $R4 ""
197 ReadRegStr $R2 HKCU $R4 "Version"
198 ReadRegStr $R3 HKCU "$R5" "UninstallString"
199 Goto try_uninstall
201 compare_hklm:
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
207 try_uninstall:
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.
215 SetOverwrite on
216 ; Need to copy uninstaller outside of the install dir
217 ClearErrors
218 CopyFiles /SILENT $R3 "$TEMP\$R6"
219 SetOverwrite off
220 IfErrors uninstall_problem
221 ; Ready to uninstall..
222 ClearErrors
223 ExecWait '"$TEMP\$R6" /S /UPGRADE=1 _?=$R1'
224 IfErrors exec_error
225 Delete "$TEMP\$R6"
226 Goto done
228 exec_error:
229 Delete "$TEMP\$R6"
230 Goto uninstall_problem
232 no_version_found:
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}
240 StrCpy $R7 "Gaim"
241 Goto start_comparison
243 uninstall_problem:
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
246 Quit
247 done:
248 SectionEnd
251 ;--------------------------------
252 ;GTK+ Runtime Install Section
254 Section $(GTKSECTIONTITLE) SecGtk
256 InitPluginsDir
257 StrCpy $R1 "$PLUGINSDIR\gtk.zip"
258 !ifdef OFFLINE_INSTALLER
260 SetOutPath $PLUGINSDIR
261 File /oname=gtk.zip ".\gtk-runtime-${GTK_INSTALL_VERSION}.zip"
263 !else
265 ; We need to download the GTK+ runtime
266 retry:
267 StrCpy $R2 "${DOWNLOADER_URL}?version=${PIDGIN_VERSION}&gtk_version=${GTK_INSTALL_VERSION}&dl_pkg=gtk"
268 DetailPrint "Downloading GTK+ Runtime ... ($R2)"
269 NSISdl::download /TIMEOUT=10000 $R2 $R1
270 Pop $R0
271 ;StrCmp $R0 "cancel" done
272 StrCmp $R0 "success" +2
273 MessageBox MB_RETRYCANCEL "$(PIDGINGTKDOWNLOADERROR)" /SD IDCANCEL IDRETRY retry IDCANCEL done
275 !endif
277 ;Delete the old Gtk directory
278 RMDir /r "$INSTDIR\Gtk"
280 SetOutPath "$INSTDIR"
281 nsisunz::UnzipToLog $R1 "$INSTDIR"
282 Pop $R0
283 StrCmp $R0 "success" +2
284 DetailPrint "$R0" ;print error message to log
286 done:
287 SectionEnd ; end of GTK+ section
289 ;--------------------------------
290 ;Pidgin Install Section
292 Section $(PIDGINSECTIONTITLE) SecPidgin
293 SectionIn 1 RO
295 ; Check install rights..
296 Call CheckUserInstallRights
297 Pop $R0
299 StrCmp $R0 "NONE" pidgin_install_files
300 StrCmp $R0 "HKLM" pidgin_hklm pidgin_hkcu
302 pidgin_hklm:
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
318 pidgin_hkcu:
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"
332 ; Pidgin files
333 SetOverwrite on
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
347 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"
353 perl_done:
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.
360 ${If} ${IsNT}
361 ${AndIf} ${IsWinNT4}
362 ;SILC
363 Delete "$INSTDIR\plugins\libsilc.dll"
364 Delete "$INSTDIR\libsilcclient-1-1-2.dll"
365 Delete "$INSTDIR\libsilc-1-1-2.dll"
366 ;GSSAPI
367 Delete "$INSTDIR\sasl2\saslGSSAPI.dll"
368 ${EndIf}
370 SetOutPath "$INSTDIR"
372 ; If we don't have install rights we're done
373 StrCmp $R0 "NONE" done
374 SetOverwrite off
376 ; write out uninstaller
377 SetOverwrite on
378 WriteUninstaller "$INSTDIR\${PIDGIN_UNINST_EXE}"
379 SetOverwrite off
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"
387 done:
388 SectionEnd ; end of default Pidgin section
390 ;--------------------------------
391 ;Shortcuts
393 SectionGroup /e $(PIDGINSHORTCUTSSECTIONTITLE) SecShortcuts
394 Section /o $(PIDGINDESKTOPSHORTCUTSECTIONTITLE) SecDesktopShortcut
395 SetOverwrite on
396 CreateShortCut "$DESKTOP\Pidgin.lnk" "$INSTDIR\pidgin.exe"
397 SetOverwrite off
398 SectionEnd
399 Section $(PIDGINSTARTMENUSHORTCUTSECTIONTITLE) SecStartMenuShortcut
400 SetOverwrite on
401 CreateShortCut "$SMPROGRAMS\Pidgin.lnk" "$INSTDIR\pidgin.exe"
402 SetOverwrite off
403 SectionEnd
404 SectionGroupEnd
406 ;--------------------------------
407 ;URI Handling
409 !macro URI_SECTION proto
410 Section /o "${proto}:" SecURI_${proto}
411 Push "${proto}"
412 Call RegisterURIHandler
413 SectionEnd
414 !macroend
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"
421 SectionGroupEnd
423 ;--------------------------------
424 ;Translations
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"
431 ${MementoSectionEnd}
432 !macroend
433 SectionGroup $(TRANSLATIONSSECTIONTITLE) SecTranslations
434 # pidgin-translations is generated based on the contents of the locale directory
435 !include "pidgin-translations.nsh"
436 SectionGroupEnd
437 ${MementoSectionDone}
439 ;--------------------------------
440 ;Spell Checking
442 !macro SPELLCHECK_SECTION lang lang_name lang_file
443 Section /o "${lang_name}" SecSpell_${lang}
444 Push ${lang_file}
445 Push ${lang}
446 Call InstallDict
447 SectionEnd
448 !macroend
449 SectionGroup $(PIDGINSPELLCHECKSECTIONTITLE) SecSpellCheck
450 !include "pidgin-spellcheck.nsh"
451 SectionGroupEnd
453 Section /o $(DEBUGSYMBOLSSECTIONTITLE) SecDebugSymbols
455 InitPluginsDir
456 StrCpy $R1 "$PLUGINSDIR\dbgsym.zip"
457 !ifdef OFFLINE_INSTALLER
459 SetOutPath $PLUGINSDIR
460 File /oname=dbgsym.zip "..\..\..\pidgin-${PIDGIN_VERSION}-dbgsym.zip"
462 !else
464 ; We need to download the debug symbols
465 retry:
466 StrCpy $R2 "${DOWNLOADER_URL}?version=${PIDGIN_VERSION}&dl_pkg=dbgsym"
467 DetailPrint "Downloading Debug Symbols... ($R2)"
468 NSISdl::download /TIMEOUT=10000 $R2 $R1
469 Pop $R0
470 StrCmp $R0 "cancel" done
471 StrCmp $R0 "success" +2
472 MessageBox MB_RETRYCANCEL "$(PIDGINDEBUGSYMBOLSERROR)" /SD IDCANCEL IDRETRY retry IDCANCEL done
474 !endif
476 SetOutPath "$INSTDIR"
477 nsisunz::UnzipToLog $R1 "$INSTDIR"
478 Pop $R0
479 StrCmp $R0 "success" +2
480 DetailPrint "$R0" ;print error message to log
482 done:
483 SectionEnd
485 ;--------------------------------
486 ;Uninstaller Section
489 Section Uninstall
490 Call un.CheckUserInstallRights
491 Pop $R0
492 StrCmp $R0 "NONE" no_rights
493 StrCmp $R0 "HKCU" try_hkcu try_hklm
495 try_hkcu:
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}"
501 Goto cont_uninstall
503 try_hklm:
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"
513 cont_uninstall:
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
522 Push "aim"
523 Call un.UnregisterURIHandler
524 Push "msnim"
525 Call un.UnregisterURIHandler
526 Push "myim"
527 Call un.UnregisterURIHandler
528 Push "ymsgr"
529 Call un.UnregisterURIHandler
530 Push "xmpp"
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)
661 ${GetParameters} $R0
662 ClearErrors
663 ${GetOptions} "$R0" "/UPGRADE=" $R1
664 IfErrors +2
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"
669 upgrade_done:
671 ;Try to remove Pidgin install dir (only if empty)
672 RMDir "$INSTDIR"
674 ; Shortcuts..
675 Delete "$DESKTOP\Pidgin.lnk"
676 Delete "$SMPROGRAMS\Pidgin.lnk"
678 Goto done
680 cant_uninstall:
681 MessageBox MB_OK $(PIDGINUNINSTALLERROR1) /SD IDOK
682 Quit
684 no_rights:
685 MessageBox MB_OK $(PIDGINUNINSTALLERROR2) /SD IDOK
686 Quit
688 done:
689 SectionEnd ; end of uninstall section
691 ;--------------------------------
692 ;Descriptions
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 ;--------------------------------
712 ;Functions
714 ; Default the URI handler checkboxes if Pidgin is the current handler or if there is no handler
715 Function SelectURIHandlerSelections
716 Push $R0
717 Push $R1
718 Push $R2
719 Push $R3
721 ; Start with the first URI handler
722 IntOp $R0 ${SecURIHandlers} + 1
724 start:
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 ':'
732 StrLen $R3 $R2
733 IntOp $R3 $R3 - 1
734 StrCpy $R2 $R2 $R3
736 ClearErrors
737 ReadRegStr $R3 HKCR "$R2" ""
738 IfErrors default_on ;there is no current handler
740 Push $R2
741 Call CheckIfPidginIsCurrentURIHandler
742 Pop $R3
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
748 default_on:
749 IntOp $R1 $R1 | ${SF_SELECTED} ; Select
750 SectionSetFlags $R0 $R1
752 end_loop:
753 IntOp $R0 $R0 + 1 ;Advance to the next section
754 Goto start
756 done:
757 Pop $R3
758 Pop $R2
759 Pop $R1
760 Pop $R0
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
767 Exch $R0
768 ClearErrors
770 ReadRegStr $R0 HKCR "$R0\shell\Open\command" ""
771 IfErrors 0 +3
772 IntOp $R0 0 + 0
773 Goto done
775 !ifdef __UNINSTALL__
776 ${un.WordFind} "$R0" "pidgin.exe" "E+1{" $R0
777 !else
778 ${WordFind} "$R0" "pidgin.exe" "E+1{" $R0
779 !endif
780 IntOp $R0 0 + 1
781 IfErrors 0 +2
782 IntOp $R0 0 + 0
784 done:
785 Exch $R0
786 FunctionEnd
787 !macroend
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
793 Exch $R0
794 Push $R1
796 Push $R0
797 Call un.CheckIfPidginIsCurrentURIHandler
798 Pop $R1
800 ; If Pidgin isn't the current handler, leave it as-is
801 IntCmp $R1 0 done
803 ;Unregister the URI handler
804 DetailPrint "Unregistering $R0 URI Handler"
805 DeleteRegKey HKCR "$R0"
807 done:
808 Pop $R1
809 Pop $R0
810 FunctionEnd
812 Function RegisterURIHandler
813 Exch $R0
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"
822 Pop $R0
823 FunctionEnd
826 !macro CheckUserInstallRightsMacro UN
827 Function ${UN}CheckUserInstallRights
828 Push $0
829 Push $1
830 ClearErrors
831 UserInfo::GetName
832 IfErrors Win9x
833 Pop $0
834 UserInfo::GetAccountType
835 Pop $1
837 StrCmp $1 "Admin" 0 +3
838 StrCpy $1 "HKLM"
839 Goto done
840 StrCmp $1 "Power" 0 +3
841 StrCpy $1 "HKLM"
842 Goto done
843 StrCmp $1 "User" 0 +3
844 StrCpy $1 "HKCU"
845 Goto done
846 StrCmp $1 "Guest" 0 +3
847 StrCpy $1 "NONE"
848 Goto done
849 ; Unknown error
850 StrCpy $1 "NONE"
851 Goto done
853 Win9x:
854 StrCpy $1 "HKLM"
856 done:
857 Exch $1
858 Exch
859 Pop $0
860 FunctionEnd
861 !macroend
862 !insertmacro CheckUserInstallRightsMacro ""
863 !insertmacro CheckUserInstallRightsMacro "un."
866 ; Usage:
867 ; Push $0 ; Path string
868 ; Call VerifyDir
869 ; Pop $0 ; 0 - Bad path 1 - Good path
871 Function VerifyDir
872 Exch $0
873 Push $1
874 Push $2
875 Loop:
876 IfFileExists $0 dir_exists
877 StrCpy $1 $0 ; save last
878 ${GetParent} $0 $0
879 StrLen $2 $0
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
885 Goto Loop
887 loop_done:
888 StrCpy $1 "$0\GaImFooB"
889 ; Check if we can create dir on this drive..
890 ClearErrors
891 CreateDirectory $1
892 IfErrors DirBad DirGood
894 dir_exists:
895 ClearErrors
896 FileOpen $1 "$0\pidginfoo.bar" w
897 IfErrors PathBad PathGood
899 DirGood:
900 RMDir $1
901 Goto PathGood1
903 DirBad:
904 RMDir $1
905 Goto PathBad1
907 PathBad:
908 FileClose $1
909 Delete "$0\pidginfoo.bar"
910 PathBad1:
911 StrCpy $0 "0"
912 Push $0
913 Goto done
915 PathGood:
916 FileClose $1
917 Delete "$0\pidginfoo.bar"
918 PathGood1:
919 StrCpy $0 "1"
920 Push $0
922 done:
923 Exch 3 ; The top of the stack contains the output variable
924 Pop $0
925 Pop $2
926 Pop $1
927 FunctionEnd
929 Function .onVerifyInstDir
930 Push $0
931 Push $INSTDIR
932 Call VerifyDir
933 Pop $0
934 StrCmp $0 "0" 0 dir_good
935 Pop $0
936 Abort
938 dir_good:
939 Pop $0
940 FunctionEnd
943 ; Usage:
944 ; Call DoWeNeedGtk
945 ; First Pop:
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
951 Function DoWeNeedGtk
952 Push $0
953 Push $1
955 IfFileExists "$INSTDIR\Gtk\CONTENTS" +3
956 Push "3"
957 Goto done
959 ClearErrors
960 ${ConfigRead} "$INSTDIR\Gtk\CONTENTS" "Bundle Version " $0
961 IfErrors 0 +3
962 Push "3"
963 Goto done
965 ${VersionCompare} ${GTK_INSTALL_VERSION} $0 $1
966 IntCmp $1 1 +3
967 Push "0" ; Have a good version
968 Goto done
970 ${VersionCompare} ${GTK_MIN_VERSION} $0 $1
971 IntCmp $1 1 +3
972 Push "1" ; Optional Upgrade
973 Goto done
974 Push "2" ; Mandatory Upgrade
975 Goto done
977 done:
978 ; The item on the stack is what we want to return
979 Exch
980 Pop $1
981 Exch
982 Pop $0
983 FunctionEnd
986 !macro RunCheckMacro UN
987 Function ${UN}RunCheck
988 Push $R0
989 Push $R1
991 IntOp $R1 0 + 0
992 retry_runcheck:
993 ; Close the Handle (needed if we're retrying)
994 IntCmp $R1 0 +2
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'
997 Pop $R0
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
1000 Abort
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'
1006 Pop $R1
1007 Pop $R0
1008 FunctionEnd
1009 !macroend
1010 !insertmacro RunCheckMacro ""
1011 !insertmacro RunCheckMacro "un."
1013 Function .onInit
1014 Push $R0
1015 Push $R1
1016 Push $R2
1017 Push $R3 ; This is only used for the Parameters throughout the function
1019 ${GetParameters} $R3
1021 IntOp $R1 0 + 0
1022 retry_runcheck:
1023 ; Close the Handle (needed if we're retrying)
1024 IntCmp $R1 0 +2
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'
1027 Pop $R0
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
1030 Abort
1032 ; Allow installer to run even if pidgin is running via "/NOPIDGINRUNCHECK=1"
1033 ; This is useful for testing
1034 ClearErrors
1035 ${GetOptions} "$R3" "/NOPIDGINRUNCHECK=" $R1
1036 IfErrors 0 +2
1037 Call RunCheck
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)
1043 ClearErrors
1044 ReadRegStr $R0 HKCU "${PIDGIN_REG_KEY}" "${MUI_LANGDLL_REGISTRY_VALUENAME}"
1045 IfErrors 0 +5
1046 ClearErrors
1047 ReadRegStr $R0 HKCU "${OLD_GAIM_REG_KEY}" "${MUI_LANGDLL_REGISTRY_VALUENAME}"
1048 IfErrors +3
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
1058 ClearErrors
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
1064 IfErrors +1 +5
1065 ClearErrors
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"
1073 ClearErrors
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
1077 ClearErrors
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"
1086 ClearErrors
1087 ${GetOptions} "$R3" "/L=" $R1
1088 IfErrors +3
1089 StrCpy $LANGUAGE $R1
1090 Goto skip_lang
1092 ; Select Language
1093 ; Display Language selection dialog
1094 !define MUI_LANGDLL_ALWAYSSHOW
1095 !insertmacro MUI_LANGDLL_DISPLAY
1096 skip_lang:
1098 ClearErrors
1099 ${GetOptions} "$R3" "/DS=" $R1
1100 IfErrors +8
1101 SectionGetFlags ${SecDesktopShortcut} $R2
1102 StrCmp "1" $R1 0 +2
1103 IntOp $R2 $R2 | ${SF_SELECTED}
1104 StrCmp "0" $R1 0 +3
1105 IntOp $R1 ${SF_SELECTED} ~
1106 IntOp $R2 $R2 & $R1
1107 SectionSetFlags ${SecDesktopShortcut} $R2
1109 ClearErrors
1110 ${GetOptions} "$R3" "/SMS=" $R1
1111 IfErrors +8
1112 SectionGetFlags ${SecStartMenuShortcut} $R2
1113 StrCmp "1" $R1 0 +2
1114 IntOp $R2 $R2 | ${SF_SELECTED}
1115 StrCmp "0" $R1 0 +3
1116 IntOp $R1 ${SF_SELECTED} ~
1117 IntOp $R2 $R2 & $R1
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
1124 ClearErrors
1125 ReadRegStr $INSTDIR HKCU "${PIDGIN_REG_KEY}" ""
1126 IfErrors +2
1127 StrCmp $INSTDIR "" 0 instdir_done
1128 ClearErrors
1129 ReadRegStr $INSTDIR HKLM "${PIDGIN_REG_KEY}" ""
1130 IfErrors +2
1131 StrCmp $INSTDIR "" 0 instdir_done
1133 Call CheckUserInstallRights
1134 Pop $R0
1136 StrCmp $R0 "HKLM" 0 user_dir
1137 StrCpy $INSTDIR "$PROGRAMFILES\Pidgin"
1138 Goto instdir_done
1139 user_dir:
1140 Push $SMPROGRAMS
1141 ${GetParent} $SMPROGRAMS $R2
1142 ${GetParent} $R2 $R2
1143 StrCpy $INSTDIR "$R2\Pidgin"
1145 instdir_done:
1146 ;LogSet on
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
1154 Pop $R3
1155 Pop $R2
1156 Pop $R1
1157 Pop $R0
1158 FunctionEnd
1160 Function .onInstSuccess
1162 ${MementoSectionSave}
1164 FunctionEnd
1167 Function un.onInit
1169 Call un.RunCheck
1170 StrCpy $name "Pidgin ${PIDGIN_VERSION}"
1171 ;LogSet on
1173 ; Get stored language preference
1174 !insertmacro MUI_UNGETLANGUAGE
1176 FunctionEnd
1178 ; Page enter and exit functions..
1180 Function preWelcomePage
1181 Push $R0
1182 Push $R1
1184 !ifdef OFFLINE_INSTALLER
1185 !insertmacro SelectSection ${SecDebugSymbols}
1186 !endif
1188 Call DoWeNeedGtk
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}
1195 Goto done
1196 gtk_not_mandatory:
1197 ; Don't select the GTK+ section if we already have this version or newer installed
1198 !insertmacro UnselectSection ${SecGtk}
1200 done:
1201 Pop $R1
1202 Pop $R0
1203 FunctionEnd
1205 ; If the GTK+ Section has been unselected and there isn't a compatible GTK+ already, confirm
1206 Function .onSelChange
1207 Push $R0
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"
1214 Goto done
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}
1223 done:
1224 Pop $R0
1225 FunctionEnd
1227 Function SelectTranslationForCurrentLanguage
1228 !insertmacro SELECT_TRANSLATION_FUNCTION
1229 FunctionEnd
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
1237 IntOp $R0 $R0 + 1
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
1243 done_${lang}:
1244 !macroend
1245 Function SelectAndDisableInstalledDictionaries
1246 Push $R0
1247 Push $R1
1249 !insertmacro SetSectionFlag ${SecSpellCheck} ${SF_RO}
1250 !insertmacro UnselectSection ${SecSpellCheck}
1252 IntOp $R0 ${SecSpellCheck} + 0
1253 !include "pidgin-spellcheck-preselect.nsh"
1255 Pop $R1
1256 Pop $R0
1257 FunctionEnd
1259 Function InstallDict
1260 Push $R0
1261 Exch
1262 Pop $R0 ;This is the language code
1263 Push $R1
1264 Exch 2
1265 Pop $R1 ;This is the language file
1266 Push $R2
1267 Push $R3
1268 Push $R4
1270 ClearErrors
1271 IfFileExists "$INSTDIR\spellcheck\share\enchant\myspell\$R0.dic" installed
1273 InitPluginsDir
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)"
1279 retry:
1280 NSISdl::download /TIMEOUT=10000 "$R3" "$R2"
1281 Pop $R4
1282 StrCmp $R4 "cancel" done
1283 StrCmp $R4 "success" +3
1284 MessageBox MB_RETRYCANCEL "$(PIDGINSPELLCHECKERROR)" /SD IDCANCEL IDRETRY retry IDCANCEL done
1285 Goto done
1286 SetOutPath "$INSTDIR\spellcheck\share\enchant\myspell"
1287 nsisunz::UnzipToLog "$R2" "$OUTDIR"
1288 SetOutPath "$INSTDIR"
1289 Pop $R3
1290 StrCmp $R3 "success" installed
1291 DetailPrint "$R3" ;print error message to log
1292 Goto done
1294 installed: ;The dictionary is currently installed, no error message
1295 DetailPrint "$R0 Dictionary is installed"
1297 done:
1298 Pop $R4
1299 Pop $R3
1300 Pop $R2
1301 Pop $R0
1302 Exch $R1
1303 FunctionEnd