ajout de la gestion des adresses POP et mise à jour de l'interface utilisateur

This commit is contained in:
jopazerty
2025-03-17 10:24:20 +01:00
parent 31a0e5b48f
commit 0aad7fadba

View File

@ -52,17 +52,17 @@ $labSizeProfile = GUICtrlCreateLabel("", 220, 25, 150, 30)
GUICtrlSetColor(-1, $color) GUICtrlSetColor(-1, $color)
GUIctrlSetFont(-1,11, 600, Default, "Segoe UI") GUIctrlSetFont(-1,11, 600, Default, "Segoe UI")
;~ GUICtrlSetBkColor(-1, 0xff0000) ;~ GUICtrlSetBkColor(-1, 0xff0000)
GUICtrlCreateLabel("Domaine(s) :", 390, 25, 75, 30) ;~ GUICtrlCreateLabel("Domaine(s) :", 390, 25, 75, 30)
GUICtrlSetColor(-1, $color) ;~ GUICtrlSetColor(-1, $color)
GUICtrlSetTip(-1, "Séparez les domaines par un |", "Domaines à rechercher") ;~ GUICtrlSetTip(-1, "Séparez les domaines par un |", "Domaines à rechercher")
GUICtrlSetCursor(-1, 4) ;~ GUICtrlSetCursor(-1, 4)
$searchDoamin = GUICtrlCreateInput("ac-nice.fr", 470, 21, 140, 25) ;~ $searchDoamin = GUICtrlCreateInput("ac-nice.fr|ac-aix-marseille.fr", 470, 21, 140, 25)
GUICtrlSetFont(-1, 10, 500, Default, "Segoe UI") ;~ GUICtrlSetFont(-1, 10, 500, Default, "Segoe UI")
$refresh = GUICtrlCreateLabel("🔄", 610, 20, 30, 33) ;~ $refresh = GUICtrlCreateLabel("🔄", 610, 20, 30, 33)
GUICtrlSetFont(-1, 15, 500, Default, "Segoe UI") ;~ GUICtrlSetFont(-1, 15, 500, Default, "Segoe UI")
GUICtrlSetColor(-1, $color) ;~ GUICtrlSetColor(-1, $color)
GUICtrlSetCursor(-1, 0) ;~ GUICtrlSetCursor(-1, 0)
GUICtrlSetTip(-1, "Rafraichir la liste des comptes") ;~ GUICtrlSetTip(-1, "Rafraichir la liste des comptes")
$modifProFileDirectory = GUICtrlCreateButton("📂 Modifier", 660, 17, 120, 33) $modifProFileDirectory = GUICtrlCreateButton("📂 Modifier", 660, 17, 120, 33)
GUICtrlSetBkColor(-1, $color2) GUICtrlSetBkColor(-1, $color2)
GUICtrlSetColor(-1, 0xffffff) GUICtrlSetColor(-1, 0xffffff)
@ -155,8 +155,8 @@ While 1
GUICtrlSetData($labSizeSave, "("&Round(DriveSpaceFree($dstSave)/1024, 0)&" Go disponible)") GUICtrlSetData($labSizeSave, "("&Round(DriveSpaceFree($dstSave)/1024, 0)&" Go disponible)")
_getAllServer($profileDirectory) _getAllServer($profileDirectory)
EndIf EndIf
Case $refresh ;~ Case $refresh
_getAllServer($profileDirectory) ;~ _getAllServer($profileDirectory)
Case $modifSaveDirectory Case $modifSaveDirectory
$newSaveFolder = FileSelectFolder("Séléctionnez le dossier de sauvegarde", @AppDataDir&"\Thunderbird\Profiles") $newSaveFolder = FileSelectFolder("Séléctionnez le dossier de sauvegarde", @AppDataDir&"\Thunderbird\Profiles")
If Not @error Then If Not @error Then
@ -201,26 +201,34 @@ While 1
$servID = $allServer[$c][3] $servID = $allServer[$c][3]
$directory = $allServer[$c][4] $directory = $allServer[$c][4]
$smtpID = $allServer[$c][5] $smtpID = $allServer[$c][5]
$sizePopAccount = $allServer[$c][6] $popAdress = $allServer[$c][6]
FileWrite($profileDirectory&"\user.js", 'user_pref("mail.identity.'&$identity&'.archive_folder", "imap://'&$accountName&'@imap.ac-nice.fr/Archives");'&@CRLF) If StringInStr($popAdress, "ac-nice.fr") Then
FileWrite($profileDirectory&"\user.js", 'user_pref("mail.identity.'&$identity&'.draft_folder", "imap://'&$accountName&'@imap.ac-nice.fr/Drafts");'&@CRLF) $domain = ".ac-nice.fr"
FileWrite($profileDirectory&"\user.js", 'user_pref("mail.identity.'&$identity&'.fcc_folder", "imap://'&$accountName&'@imap.ac-nice.fr/Sent");'&@CRLF) $smtpAddress = "smtps.ac-nice.fr"
FileWrite($profileDirectory&"\user.js", 'user_pref("mail.identity.'&$identity&'.stationery_folder", "imap://'&$accountName&'@imap.ac-nice.fr/Templates");'&@CRLF) ElseIf StringInStr($popAdress, "ac-aix-marseille.fr") Then
$domain = ".ac-aix-marseille.fr"
$smtpAddress = "smtp.ac-aix-marseille.fr"
EndIf
FileWrite($profileDirectory&"\user.js", 'user_pref("mail.identity.'&$identity&'.archive_folder", "imap://'&$accountName&'@imap'&$domain&'/Archives");'&@CRLF)
FileWrite($profileDirectory&"\user.js", 'user_pref("mail.identity.'&$identity&'.draft_folder", "imap://'&$accountName&'@imap'&$domain&'/Drafts");'&@CRLF)
FileWrite($profileDirectory&"\user.js", 'user_pref("mail.identity.'&$identity&'.fcc_folder", "imap://'&$accountName&'@imap'&$domain&'/Sent");'&@CRLF)
FileWrite($profileDirectory&"\user.js", 'user_pref("mail.identity.'&$identity&'.stationery_folder", "imap://'&$accountName&'@imap'&$domain&'/Templates");'&@CRLF)
$randomUID = Random(10000, 99999, 1) $randomUID = Random(10000, 99999, 1)
FileWrite($profileDirectory&"\user.js", 'user_pref("mail.server.'&$servID&'.directory", "'&StringReplace($proFileDirectory, "\", "\\")&'\\ImapMail\\imap.ac-nice.fr-'&$randomUID&'");'&@CRLF);'&@CRLF) FileWrite($profileDirectory&"\user.js", 'user_pref("mail.server.'&$servID&'.directory", "'&StringReplace($proFileDirectory, "\", "\\")&'\\ImapMail\\imap'&$domain&'-'&$randomUID&'");'&@CRLF);'&@CRLF)
FileWrite($profileDirectory&"\user.js", 'user_pref("mail.server.'&$servID&'.directory-rel", "[ProfD]ImapMail/imap.ac-nice.fr-'&$randomUID&'");'&@CRLF);'&@CRLF) FileWrite($profileDirectory&"\user.js", 'user_pref("mail.server.'&$servID&'.directory-rel", "[ProfD]ImapMail/imap'&$domain&'-'&$randomUID&'");'&@CRLF);'&@CRLF)
FileWrite($profileDirectory&"\user.js", 'user_pref("mail.server.'&$servID&'.hostname", "imap.ac-nice.fr");'&@CRLF);'&@CRLF) FileWrite($profileDirectory&"\user.js", 'user_pref("mail.server.'&$servID&'.hostname", "imap'&$domain&'");'&@CRLF);'&@CRLF)
FileWrite($profileDirectory&"\user.js", 'user_pref("mail.server.'&$servID&'.type", "imap");'&@CRLF);'&@CRLF) FileWrite($profileDirectory&"\user.js", 'user_pref("mail.server.'&$servID&'.type", "imap");'&@CRLF);'&@CRLF)
FileWrite($profileDirectory&"\user.js", 'user_pref("mail.server.'&$servID&'.port", 993);'&@CRLF) FileWrite($profileDirectory&"\user.js", 'user_pref("mail.server.'&$servID&'.port", 993);'&@CRLF)
FileWrite($profileDirectory&"\user.js", 'user_pref("mail.server.'&$servID&'.socketType", 3);'&@CRLF);'&@CRLF) FileWrite($profileDirectory&"\user.js", 'user_pref("mail.server.'&$servID&'.socketType", 3);'&@CRLF);'&@CRLF)
FileWrite($profileDirectory&"\user.js", 'user_pref("mail.server.'&$servID&'.spamActionTargetAccount", "imap://'&$accountName&'@imap.ac-nice.fr");'&@CRLF);'&@CRLF) FileWrite($profileDirectory&"\user.js", 'user_pref("mail.server.'&$servID&'.spamActionTargetAccount", "imap://'&$accountName&'@imap'&$domain&'");'&@CRLF);'&@CRLF)
FileWrite($profileDirectory&"\user.js", 'user_pref("mail.server.'&$servID&'.namespace.personal", "\"\"");'&@CRLF) FileWrite($profileDirectory&"\user.js", 'user_pref("mail.server.'&$servID&'.namespace.personal", "\"\"");'&@CRLF)
FileWrite($profileDirectory&"\user.js", 'user_pref("mail.server.'&$servID&'.namespace.public", "\"Shared Folders/Public/\"");'&@CRLF) FileWrite($profileDirectory&"\user.js", 'user_pref("mail.server.'&$servID&'.namespace.public", "\"Shared Folders/Public/\"");'&@CRLF)
FileWrite($profileDirectory&"\user.js", 'user_pref("mail.smtpserver.'&$smtpID&'.authMethod", 3);'&@CRLF) FileWrite($profileDirectory&"\user.js", 'user_pref("mail.smtpserver.'&$smtpID&'.authMethod", 3);'&@CRLF)
FileWrite($profileDirectory&"\user.js", 'user_pref("mail.smtpserver.'&$smtpID&'.description", "");'&@CRLF) FileWrite($profileDirectory&"\user.js", 'user_pref("mail.smtpserver.'&$smtpID&'.description", "");'&@CRLF)
FileWrite($profileDirectory&"\user.js", 'user_pref("mail.smtpserver.'&$smtpID&'.hostname", "smtps.ac-nice.fr");'&@CRLF)
FileWrite($profileDirectory&"\user.js", 'user_pref("mail.smtpserver.'&$smtpID&'.hostname", "'&$smtpAddress&'");'&@CRLF)
FileWrite($profileDirectory&"\user.js", 'user_pref("mail.smtpserver.'&$smtpID&'.port", 465);'&@CRLF) FileWrite($profileDirectory&"\user.js", 'user_pref("mail.smtpserver.'&$smtpID&'.port", 465);'&@CRLF)
FileWrite($profileDirectory&"\user.js", 'user_pref("mail.smtpserver.'&$smtpID&'.try_ssl", 3);'&@CRLF) FileWrite($profileDirectory&"\user.js", 'user_pref("mail.smtpserver.'&$smtpID&'.try_ssl", 3);'&@CRLF)
FileWrite($profileDirectory&"\user.js", 'user_pref("mail.smtpserver.'&$smtpID&'.type", "smtp");'&@CRLF) FileWrite($profileDirectory&"\user.js", 'user_pref("mail.smtpserver.'&$smtpID&'.type", "smtp");'&@CRLF)
@ -325,7 +333,8 @@ Func _getAllServer($profileDirectory)
$searchForAcNice = _searchValueInPrefsJsArrayRegex($prefsToArray, "mail\.server\."&$serverID&"\.hostname$") $searchForAcNice = _searchValueInPrefsJsArrayRegex($prefsToArray, "mail\.server\."&$serverID&"\.hostname$")
For $p = 1 To $searchForAcNice[0] For $p = 1 To $searchForAcNice[0]
;~ If StringInStr($searchForAcNice[$p], "ac-nice.fr") Then ;~ If StringInStr($searchForAcNice[$p], "ac-nice.fr") Then
$domainToSearch = GUICtrlRead($searchDoamin) ;~ $domainToSearch = GUICtrlRead($searchDoamin)
$domainToSearch = "ac-nice.fr|ac-aix-marseille.fr"
$domainToSearch = StringReplace($domainToSearch, ".", "\.") $domainToSearch = StringReplace($domainToSearch, ".", "\.")
$domainToSearch = StringReplace($domainToSearch, " ", "") $domainToSearch = StringReplace($domainToSearch, " ", "")
if StringRegExp($searchForAcNice[$p], $domainToSearch) Then if StringRegExp($searchForAcNice[$p], $domainToSearch) Then
@ -340,6 +349,7 @@ Func _getAllServer($profileDirectory)
if $smtpID = "0" Then if $smtpID = "0" Then
$smtpID = _searchValueInPrefsJsArray($prefsToArray, "mail.smtp.defaultserver") $smtpID = _searchValueInPrefsJsArray($prefsToArray, "mail.smtp.defaultserver")
EndIf EndIf
$popHostname = $searchForAcNice[$p]
;~ ConsoleWrite($smtpID&@CRLF) ;~ ConsoleWrite($smtpID&@CRLF)
;~ $mail = $infoServeur[4] ;~ $mail = $infoServeur[4]
;~ $username = $infoServeur[2] ;~ $username = $infoServeur[2]
@ -350,7 +360,7 @@ Func _getAllServer($profileDirectory)
$allServer[$count][3] = $serverID $allServer[$count][3] = $serverID
$allServer[$count][4] = $directory $allServer[$count][4] = $directory
$allServer[$count][5] = $smtpID $allServer[$count][5] = $smtpID
$allServer[$count][6] = DirGetSize($directory) $allServer[$count][6] = $popHostname
;~ $allServer[$count][2] = $username ;~ $allServer[$count][2] = $username
;~ $allServer[$count][3] = StringReplace($directory, "\\", "\") ;~ $allServer[$count][3] = StringReplace($directory, "\\", "\")
;~ $allServer[$count][4] = StringReplace($signature, "\\", "\") ;~ $allServer[$count][4] = StringReplace($signature, "\\", "\")
@ -362,9 +372,9 @@ Func _getAllServer($profileDirectory)
if $count = 0 then GUICtrlSetState($go, $GUI_DISABLE) if $count = 0 then GUICtrlSetState($go, $GUI_DISABLE)
Redim $allServer[$count][7] Redim $allServer[$count][7]
;~ _ArrayDisplay($allServer) ;~ _ArrayDisplay($allServer)
;~ GUICtrlDelete($listview) GUICtrlDelete($listview)
;~ $listview = GUICtrlCreateListView("Username|Account|ID|ServerID|Dossier de stockage|smtpID", 20, 220, 760, 250) $listview = GUICtrlCreateListView("Username|Account|ID|ServerID|Dossier de stockage|smtpID|Adresse du POP", 20, 220, 760, 250)
;~ GUICtrlSetFont(-1, 11, 500, Default, "Segoe UI") GUICtrlSetFont(-1, 11, 500, Default, "Segoe UI")
_GUICtrlListView_AddArray($listview, $allServer) _GUICtrlListView_AddArray($listview, $allServer)
;~ Redim $allServer[$count][6] ;~ Redim $allServer[$count][6]
GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 0, -1) ; $LVSCW_AUTOSIZE GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 0, -1) ; $LVSCW_AUTOSIZE
@ -374,6 +384,7 @@ Func _getAllServer($profileDirectory)
GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 4, -1) ; $LVSCW_AUTOSIZE GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 4, -1) ; $LVSCW_AUTOSIZE
GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 5, -1) ; $LVSCW_AUTOSIZE GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 5, -1) ; $LVSCW_AUTOSIZE
GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 6, -1) ; $LVSCW_AUTOSIZE GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 6, -1) ; $LVSCW_AUTOSIZE
GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 7, -1) ; $LVSCW_AUTOSIZE
GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 0, -2) ; $LVSCW_AUTOSIZE_USEHEADER GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 0, -2) ; $LVSCW_AUTOSIZE_USEHEADER
GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 1, -2) ; $LVSCW_AUTOSIZE_USEHEADER GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 1, -2) ; $LVSCW_AUTOSIZE_USEHEADER
GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 2, -2) ; $LVSCW_AUTOSIZE_USEHEADER GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 2, -2) ; $LVSCW_AUTOSIZE_USEHEADER
@ -381,6 +392,7 @@ Func _getAllServer($profileDirectory)
GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 4, -2) ; $LVSCW_AUTOSIZE_USEHEADER GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 4, -2) ; $LVSCW_AUTOSIZE_USEHEADER
GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 5, -2) ; $LVSCW_AUTOSIZE_USEHEADER GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 5, -2) ; $LVSCW_AUTOSIZE_USEHEADER
GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 6, -2) ; $LVSCW_AUTOSIZE_USEHEADER GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 6, -2) ; $LVSCW_AUTOSIZE_USEHEADER
GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 7, -2) ; $LVSCW_AUTOSIZE_USEHEADER
EndFunc EndFunc