Support for a new source archive format that should be able to fool GMail.

[DEVELOPMENT ENVIRONMENT]
* NEW: Update French translation.
* NEW: Use String.RemoveDiacritics() instead of the old local utility function.
* NEW: Support for a new source archive format that should be able to fool GMail.
This commit is contained in:
gambas 2021-02-17 01:58:42 +01:00
parent 8b20024659
commit 8ace926aaa
6 changed files with 102 additions and 70 deletions

View file

@ -222,7 +222,7 @@
msgid ""
msgstr ""
"Project-Id-Version: gambas3 3.15.90\n"
"PO-Revision-Date: 2021-02-16 06:19 UTC\n"
"PO-Revision-Date: 2021-02-17 00:57 UTC\n"
"Last-Translator: Benoît Minisini <g4mba5@gmail.com>\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
@ -1881,7 +1881,7 @@ msgstr "Déselectionner tout"
msgid "Gambas 3 project conversion"
msgstr "Conversion en projet Gambas 3"
#: FCrash.class:73 FTranslate.class:245 Project.module:4759
#: FCrash.class:73 FTranslate.class:245 Project.module:4758
msgid "The '&1' command has failed."
msgstr "La commande '&1' a échoué."
@ -3391,7 +3391,7 @@ msgstr "Recharger le projet"
msgid "Quit"
msgstr "Quitter"
#: FMain.form:400 Project.module:6920
#: FMain.form:400 Project.module:6923
msgid "Save as"
msgstr "Enregistrer sous"
@ -4144,7 +4144,7 @@ msgstr "Selectionnez l'archive source"
msgid "*.gz;*.bz2;*.xz"
msgstr ""
#: FMakePatch.form:97 Project.module:4805
#: FMakePatch.form:97 Project.module:4808
msgid "Source packages"
msgstr "Paquets sources"
@ -4185,7 +4185,7 @@ msgstr "Nom de groupe incorrect !"
msgid "This menu is too deep !"
msgstr "Ce menu est trop profond !"
#: FMenu.class:1101 Project.module:5693
#: FMenu.class:1101 Project.module:5696
msgid "modified"
msgstr "modifié"
@ -6009,7 +6009,7 @@ msgstr "Nouveau projet..."
msgid "Recent projects"
msgstr "Projets récents"
#: FWelcome.class:73 Project.module:6539
#: FWelcome.class:73 Project.module:6542
msgid "Installed software"
msgstr "Logiciels installés"
@ -7593,7 +7593,7 @@ msgstr "'makepkg' a échoué."
msgid "The directory is not a Gambas project"
msgstr "Le répertoire n'est pas un projet Gambas"
#: Patch.class:52 Project.module:4772
#: Patch.class:52 Project.module:4775
msgid "Unsupported source archive format."
msgstr "Format d'archive source non supporté."
@ -7901,71 +7901,75 @@ msgstr "Le répertoire du projet existe déjà."
msgid "The project directory cannot be created because a file with the same name already exists."
msgstr "Le répertoire du projet ne peut être créé car un fichier avec le même nom existe déjà."
#: Project.module:4778
#: Project.module:4781
msgid "Unable to create source archive."
msgstr "Impossible de créer l'archive source."
#: Project.module:4804
#: Project.module:4807
msgid "Create source package"
msgstr "Générer une archive des sources du projet"
#: Project.module:5096
#: Project.module:4808
msgid "Source packages that fool GMail"
msgstr "Paquets sources qui trompent GMail"
#: Project.module:5099
msgid "Cannot copy file &1."
msgstr "Impossible de copier le fichier &1."
#: Project.module:5144
#: Project.module:5147
msgid "Cannot create link &1."
msgstr "Impossible de créer le lien &1."
#: Project.module:5159
#: Project.module:5162
msgid "Cannot move a directory inside itself."
msgstr "Impossible de déplacer un répertoire à l'intérieur de lui-même."
#: Project.module:5223
#: Project.module:5226
msgid "Cannot move file &1."
msgstr "Impossible de déplacer le fichier &1."
#: Project.module:5436
#: Project.module:5439
msgid "The following files couldn't be removed:"
msgstr "Les fichiers suivants n'ont pu être supprimés :"
#: Project.module:5918
#: Project.module:5921
msgid "Project cleanup..."
msgstr "Nettoyage du projet..."
#: Project.module:5924
#: Project.module:5927
msgid "Project files conversion..."
msgstr "Conversion des fichiers du projet..."
#: Project.module:5954
#: Project.module:5957
msgid "Unable to convert &1"
msgstr "Impossible de convertir &1"
#: Project.module:6234
#: Project.module:6237
msgid "Unable to update forms."
msgstr "Impossible de mettre à-jour les formulaires."
#: Project.module:6324
#: Project.module:6327
msgid "The &1 program is not installed on your system."
msgstr "Le programme &1 n'est pas installé sur votre système."
#: Project.module:6326
#: Project.module:6329
msgid "The following programs are not installed on your system: &1."
msgstr "Les programmes suivants ne sont pas installés sur votre système : &1."
#: Project.module:6417
#: Project.module:6420
msgid "Unable to read component description file."
msgstr "Impossible de lire le fichier de description du composant."
#: Project.module:6478
#: Project.module:6481
msgid "Cannot write component description file."
msgstr "Impossible d'écrire le fichier de description du composant."
#: Project.module:6539
#: Project.module:6542
msgid "Project templates"
msgstr "Modèles de projet"
#: Project.module:6585
#: Project.module:6588
msgid "Unable to run terminal."
msgstr "Impossible de démarrer le terminal."
@ -7977,22 +7981,26 @@ msgstr "Impossible d'enregistrer le fichier !"
msgid "Published &1"
msgstr "Publié &1"
#: Util.module:39
#: Util.module:6
msgid "&1 B"
msgstr "&1 o"
#: Util.module:41
#: Util.module:8
msgid "&1 KiB"
msgstr "&1 Kio"
#: Util.module:43
#: Util.module:10
msgid "&1 MiB"
msgstr "&1 Mio"
#: Util.module:45
#: Util.module:12
msgid "&1 GiB"
msgstr "&1 Gio"
#: Util.module:46
msgid "Incorrect format"
msgstr "Format incorrect"
#: VersionControl.module:85
msgid "Please set the $EDITOR environment variable with your favorite graphical text editor. Some version control commands need it."
msgstr "Veuillez définir la variable d'environnement $EDITOR avec votre éditeur de texte graphique favori. Les commandes de suivi de version en ont besoin."

View file

@ -534,12 +534,12 @@ Public Sub Match(sFilter As String) As Boolean
For Each sFilter In Split(sFilter, " ", Chr$(34), True)
sFilter = Util.RemoveAccents(sFilter)
sFilter = String.RemoveDiacritics(sFilter)
If InStr(Util.RemoveAccents(Key), sFilter, 1, gb.IgnoreCase) Then Return True
If InStr(Util.RemoveAccents(Name), sFilter, 1, gb.IgnoreCase) Then Return True
If InStr(Util.RemoveAccents(Authors.Join("\n")), sFilter, 1, gb.IgnoreCase) Then Return True
If InStr(Util.RemoveAccents(Implement.Join("\n")), sFilter, 1, gb.IgnoreCase) Then Return True
If InStr(String.RemoveDiacritics(Key), sFilter, 1, gb.IgnoreCase) Then Return True
If InStr(String.RemoveDiacritics(Name), sFilter, 1, gb.IgnoreCase) Then Return True
If InStr(String.RemoveDiacritics(Authors.Join("\n")), sFilter, 1, gb.IgnoreCase) Then Return True
If InStr(String.RemoveDiacritics(Implement.Join("\n")), sFilter, 1, gb.IgnoreCase) Then Return True
Next

View file

@ -219,7 +219,7 @@ Private Function TransformField(sName As String) As String
' sNewName &= sCar
' Next
Return Util.RemoveAccents(sName)
Return String.RemoveDiacritics(sName)
End

View file

@ -17,6 +17,8 @@ End
Public Sub Form_Open()
$sLast = ""
dchProject.UncompressFilter = ["*.tar.gz.gmail.txt"]
dchProject.Bookmarks = Project.GetBookmarks()
dchProject.ShowFile = True
dchProject_Change
@ -184,3 +186,9 @@ Public Sub Form_Arrange()
panOpen.Raise
End
Public Sub dchProject_Uncompress(Path As String)
Util.UncompressForGmail(Path)
End

View file

@ -4736,7 +4736,7 @@ Public Sub MakeSourcePackageFromTo(sFrom As String, sPath As String) As Boolean
sCmdName = "tar"
If sPath Ends ".gz" Then
If sPath Ends ".gz" Or If sPath Ends ".gz.gmail.txt" Then
sOpt = "z"
Else If sPath Ends ".bz2" Then
sOpt = "j"
@ -4755,9 +4755,12 @@ Public Sub MakeSourcePackageFromTo(sFrom As String, sPath As String) As Boolean
End Select
Shell sCmd To sOutput
If Not Exist(sTemp) Then Error.Raise(Subst$(("The '&1' command has failed.") & "\n\n<tt>" & Html(Trim(sOutput)) & "</tt>", sCmdName))
If sPath Ends ".gz.gmail.txt" Then
sTemp = Util.CompressForGmail(sTemp)
Endif
Try Kill sPath
Copy sTemp To sPath
Try Kill sTemp
@ -4802,7 +4805,7 @@ Public Sub MakeSourceArchive()
Dialog.Path = sDir &/ GetDefaultArchiveBaseName()
Dialog.Title = ("Create source package")
Dialog.Filter = ["*.tar.gz", ("Source packages"), "*.tar.bz2", ("Source packages"), "*.tar.xz", ("Source packages"), "*.zip", ("Source packages")]
Dialog.Filter = ["*.tar.gz", ("Source packages"), "*.tar.gz.gmail.txt", ("Source packages that fool GMail"), "*.tar.bz2", ("Source packages"), "*.tar.xz", ("Source packages"), "*.zip", ("Source packages")]
Dialog.AutoExt = True
If Dialog.SaveFile() Then Return

View file

@ -1,38 +1,5 @@
' Gambas module file
Private Const REMOVE_ACC As String = "ÀÁÂÃÄÅ[A]àáâãäå[a]Æ[AE]æ[ae]Œ[OE]œ[oe]Ç[C]ç[c]ÈÉÊËẼ[E]èéêëẽ[e]ÌÍÎĨÏ[I]ìíîïĩ[i]ÑŃǸ[N]ñńǹ[n]ÒÓÔÕÖ[O]òóôõö[o]ÙÚÛÜ[U]ùúûü[u]ÝŸ[Y]ýÿ[y]ß[ss]°[]"
Public Sub RemoveAccents(sStr As String) As String
Dim iInd As Integer
Dim sCar As String
Dim iPos As Integer
Dim iPosL As Integer
Dim iPosR As Integer
Dim sNewStr As String
If Not sStr Then Return
If IsAscii(sStr) Then Return sStr
For iInd = 1 To String.Len(sStr)
sCar = String.Mid$(sStr, iInd, 1)
If Len(sCar) > 1 Then
iPos = InStr(REMOVE_ACC, sCar)
If iPos Then
iPosL = InStr(REMOVE_ACC, "[", iPos + 1)
iPosR = InStr(REMOVE_ACC, "]", iPos + 1)
If iPosL <> 0 And If iPosR <> 0 And If iPosL < iPosR Then
sCar = Mid$(REMOVE_ACC, iPosL + 1, iPosR - iPosL - 1)
Endif
Endif
Endif
sNewStr &= sCar
Next
Return sNewStr
End
Public Sub GetFileSize(iSize As Long) As String
If iSize < 1000 Then
@ -47,6 +14,52 @@ Public Sub GetFileSize(iSize As Long) As String
End
Public Sub CompressForGmail(sPath As String) As String
Dim sDest As String
Dim hFile As File
Dim sBase64 As String
Dim I As Integer
sDest = sPath & ".gmail.txt"
hFile = Open sDest For Output Create
Print #hFile, "<salt FCKGM-0001-"; Hex$(Rand(0, 65535), 4); "-"; Hex$(Rand(0, 65535), 4); "-"; Hex$(Rand(0, 65535), 4); ">"
sBase64 = Base64(File.Load(sPath))
For I = 1 To Len(sBase64) Step 76
Print #hFile, Mid$(sBase64, I, 76)
Next
Print #hFile, "</salt>"
Close #hFile
Try Kill sPath
Return sDest
End
Public Sub UncompressForGmail(sPath As String)
Dim aData As String[]
Dim sDest As String
aData = Split(File.Load(sPath), "\n")
If Not aData.Last Then aData.Remove(aData.Max)
If aData[0] Not Like "<salt FCKGM-0001-*>" Or If aData.Last <> "</salt>" Then Error.Raise(("Incorrect format"))
aData.Remove(0)
aData.Remove(aData.Max)
sDest = sPath & ".tmp"
File.Save(sDest, FromBase64(aData.Join("")))
Try Kill sPath
If sPath Ends ".gmail.txt" Then
Move sDest To Left(sPath, -10)
Else
Move sDest To sPath
Endif
End
Public Sub Main()
Dim A As Float