summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/de/autogen/user/script_commands.txt1
-rw-r--r--doc/de/autogen/user/script_options.txt10
-rw-r--r--doc/en/autogen/user/script_commands.txt1
-rw-r--r--doc/en/autogen/user/script_options.txt10
-rw-r--r--doc/fr/autogen/user/script_commands.txt1
-rw-r--r--doc/fr/autogen/user/script_options.txt10
-rw-r--r--doc/it/autogen/user/script_commands.txt1
-rw-r--r--doc/it/autogen/user/script_options.txt10
-rw-r--r--doc/ja/autogen/user/script_commands.txt1
-rw-r--r--doc/ja/autogen/user/script_options.txt10
-rw-r--r--po/cs.po17
-rw-r--r--po/de.po17
-rw-r--r--po/es.po17
-rw-r--r--po/fr.po33
-rw-r--r--po/hu.po17
-rw-r--r--po/it.po17
-rw-r--r--po/ja.po17
-rw-r--r--po/pl.po17
-rw-r--r--po/pt_BR.po17
-rw-r--r--po/ru.po17
-rw-r--r--po/weechat.pot17
-rw-r--r--src/plugins/script/script-action.c236
-rw-r--r--src/plugins/script/script-buffer.c44
-rw-r--r--src/plugins/script/script-buffer.h5
-rw-r--r--src/plugins/script/script-command.c11
-rw-r--r--src/plugins/script/script-config.c73
-rw-r--r--src/plugins/script/script-config.h3
-rw-r--r--src/plugins/script/script-repo.c56
-rw-r--r--src/plugins/script/script-repo.h1
29 files changed, 599 insertions, 88 deletions
diff --git a/doc/de/autogen/user/script_commands.txt b/doc/de/autogen/user/script_commands.txt
index f06320f60..4455af8b9 100644
--- a/doc/de/autogen/user/script_commands.txt
+++ b/doc/de/autogen/user/script_commands.txt
@@ -44,6 +44,7 @@ Keys on script buffer:
alt+L reload script
alt+u unload script
alt+h (un)hold script
+ alt+v view script
Input allowed on script buffer:
i/r/l/L/u/h action on script (same as keys above)
diff --git a/doc/de/autogen/user/script_options.txt b/doc/de/autogen/user/script_options.txt
index 4d7426409..3aad1492a 100644
--- a/doc/de/autogen/user/script_options.txt
+++ b/doc/de/autogen/user/script_options.txt
@@ -133,6 +133,16 @@
** Typ: Zeichenkette
** Werte: beliebige Zeichenkette (Standardwert: `"%s %n %V %v %u | %d | %t"`)
+* [[option_script.look.diff_color]] *script.look.diff_color*
+** Beschreibung: `colorize output of diff`
+** Typ: boolesch
+** Werte: on, off (Standardwert: `on`)
+
+* [[option_script.look.diff_command]] *script.look.diff_command*
+** Beschreibung: `command used to show differences between script installed and the new version in repository ("auto" = auto detect diff command (git or diff), empty value = disable diff, other string = name of command, for example "diff")`
+** Typ: Zeichenkette
+** Werte: beliebige Zeichenkette (Standardwert: `"auto"`)
+
* [[option_script.look.display_source]] *script.look.display_source*
** Beschreibung: `display source code of script on buffer with detail on a script (script is downloaded in a temporary file when detail on script is displayed)`
** Typ: boolesch
diff --git a/doc/en/autogen/user/script_commands.txt b/doc/en/autogen/user/script_commands.txt
index f06320f60..4455af8b9 100644
--- a/doc/en/autogen/user/script_commands.txt
+++ b/doc/en/autogen/user/script_commands.txt
@@ -44,6 +44,7 @@ Keys on script buffer:
alt+L reload script
alt+u unload script
alt+h (un)hold script
+ alt+v view script
Input allowed on script buffer:
i/r/l/L/u/h action on script (same as keys above)
diff --git a/doc/en/autogen/user/script_options.txt b/doc/en/autogen/user/script_options.txt
index 688e198e9..d180d8402 100644
--- a/doc/en/autogen/user/script_options.txt
+++ b/doc/en/autogen/user/script_options.txt
@@ -133,6 +133,16 @@
** type: string
** values: any string (default value: `"%s %n %V %v %u | %d | %t"`)
+* [[option_script.look.diff_color]] *script.look.diff_color*
+** description: `colorize output of diff`
+** type: boolean
+** values: on, off (default value: `on`)
+
+* [[option_script.look.diff_command]] *script.look.diff_command*
+** description: `command used to show differences between script installed and the new version in repository ("auto" = auto detect diff command (git or diff), empty value = disable diff, other string = name of command, for example "diff")`
+** type: string
+** values: any string (default value: `"auto"`)
+
* [[option_script.look.display_source]] *script.look.display_source*
** description: `display source code of script on buffer with detail on a script (script is downloaded in a temporary file when detail on script is displayed)`
** type: boolean
diff --git a/doc/fr/autogen/user/script_commands.txt b/doc/fr/autogen/user/script_commands.txt
index 5b771729e..feda348b2 100644
--- a/doc/fr/autogen/user/script_commands.txt
+++ b/doc/fr/autogen/user/script_commands.txt
@@ -44,6 +44,7 @@ Les touches sur le tampon des scripts:
alt+L recharger le script
alt+u décharger le script
alt+h (dé)figer le script
+ alt+v voir le script
Entrée autorisée sur le tampon des scripts:
i/r/l/L/u/h action sur le script (identique aux touches ci-dessus)
diff --git a/doc/fr/autogen/user/script_options.txt b/doc/fr/autogen/user/script_options.txt
index 8379fdd26..fd3593190 100644
--- a/doc/fr/autogen/user/script_options.txt
+++ b/doc/fr/autogen/user/script_options.txt
@@ -133,6 +133,16 @@
** type: chaîne
** valeurs: toute chaîne (valeur par défaut: `"%s %n %V %v %u | %d | %t"`)
+* [[option_script.look.diff_color]] *script.look.diff_color*
+** description: `colorie la sortie du diff`
+** type: booléen
+** valeurs: on, off (valeur par défaut: `on`)
+
+* [[option_script.look.diff_command]] *script.look.diff_command*
+** description: `commande utilisée pour montrer les différences entre le script installé et la nouvelle version dans le repository ("auto" = détecter automatiquement la commande de diff (git ou diff), valeur vide = désactiver le diff, autre chaîne = nom de la commande, par exemple "diff")`
+** type: chaîne
+** valeurs: toute chaîne (valeur par défaut: `"auto"`)
+
* [[option_script.look.display_source]] *script.look.display_source*
** description: `afficher le code source du script sur le tampon avec le détail sur le script (le script est téléchargé dans un fichier temporaire lorsque le détail du script est affiché)`
** type: booléen
diff --git a/doc/it/autogen/user/script_commands.txt b/doc/it/autogen/user/script_commands.txt
index f06320f60..4455af8b9 100644
--- a/doc/it/autogen/user/script_commands.txt
+++ b/doc/it/autogen/user/script_commands.txt
@@ -44,6 +44,7 @@ Keys on script buffer:
alt+L reload script
alt+u unload script
alt+h (un)hold script
+ alt+v view script
Input allowed on script buffer:
i/r/l/L/u/h action on script (same as keys above)
diff --git a/doc/it/autogen/user/script_options.txt b/doc/it/autogen/user/script_options.txt
index d80f86ead..4e27311ff 100644
--- a/doc/it/autogen/user/script_options.txt
+++ b/doc/it/autogen/user/script_options.txt
@@ -133,6 +133,16 @@
** tipo: stringa
** valori: qualsiasi stringa (valore predefinito: `"%s %n %V %v %u | %d | %t"`)
+* [[option_script.look.diff_color]] *script.look.diff_color*
+** descrizione: `colorize output of diff`
+** tipo: bool
+** valori: on, off (valore predefinito: `on`)
+
+* [[option_script.look.diff_command]] *script.look.diff_command*
+** descrizione: `command used to show differences between script installed and the new version in repository ("auto" = auto detect diff command (git or diff), empty value = disable diff, other string = name of command, for example "diff")`
+** tipo: stringa
+** valori: qualsiasi stringa (valore predefinito: `"auto"`)
+
* [[option_script.look.display_source]] *script.look.display_source*
** descrizione: `display source code of script on buffer with detail on a script (script is downloaded in a temporary file when detail on script is displayed)`
** tipo: bool
diff --git a/doc/ja/autogen/user/script_commands.txt b/doc/ja/autogen/user/script_commands.txt
index f06320f60..4455af8b9 100644
--- a/doc/ja/autogen/user/script_commands.txt
+++ b/doc/ja/autogen/user/script_commands.txt
@@ -44,6 +44,7 @@ Keys on script buffer:
alt+L reload script
alt+u unload script
alt+h (un)hold script
+ alt+v view script
Input allowed on script buffer:
i/r/l/L/u/h action on script (same as keys above)
diff --git a/doc/ja/autogen/user/script_options.txt b/doc/ja/autogen/user/script_options.txt
index 64d4dcf4a..913009d67 100644
--- a/doc/ja/autogen/user/script_options.txt
+++ b/doc/ja/autogen/user/script_options.txt
@@ -133,6 +133,16 @@
** タイプ: 文字列
** 値: 未制約文字列 (デフォルト値: `"%s %n %V %v %u | %d | %t"`)
+* [[option_script.look.diff_color]] *script.look.diff_color*
+** 説明: `colorize output of diff`
+** タイプ: ブール
+** 値: on, off (デフォルト値: `on`)
+
+* [[option_script.look.diff_command]] *script.look.diff_command*
+** 説明: `command used to show differences between script installed and the new version in repository ("auto" = auto detect diff command (git or diff), empty value = disable diff, other string = name of command, for example "diff")`
+** タイプ: 文字列
+** 値: 未制約文字列 (デフォルト値: `"auto"`)
+
* [[option_script.look.display_source]] *script.look.display_source*
** 説明: `display source code of script on buffer with detail on a script (script is downloaded in a temporary file when detail on script is displayed)`
** タイプ: ブール
diff --git a/po/cs.po b/po/cs.po
index a1b08016f..d04241892 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2012-08-28 16:36+0200\n"
+"POT-Creation-Date: 2012-08-30 08:37+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -8297,13 +8297,13 @@ msgstr "ukončit WeeChat"
msgid "Max WeeChat"
msgstr "ukončit WeeChat"
-msgid "alt+d=back to list"
+msgid "Alt+key/input: v=back to list d=jump to diff"
msgstr ""
#, c-format
msgid ""
"%d/%d scripts (filter: %s) | Sort: %s | Alt+key/input: i=install r=remove "
-"l=load L=reload u=unload h=(un)hold d=show detail | Input: q=close $=refresh "
+"l=load L=reload u=unload h=(un)hold v=view script | Input: q=close $=refresh "
"s:x,y=sort words=filter *=reset filter | Mouse: left=select right=install/"
"remove"
msgstr ""
@@ -8361,6 +8361,7 @@ msgid ""
" alt+L reload script\n"
" alt+u unload script\n"
" alt+h (un)hold script\n"
+" alt+v view script\n"
"\n"
"Input allowed on script buffer:\n"
" i/r/l/L/u/h action on script (same as keys above)\n"
@@ -8408,6 +8409,16 @@ msgid ""
"loaded, %w=min_weechat, %W=max_weechat)"
msgstr ""
+msgid "colorize output of diff"
+msgstr ""
+
+msgid ""
+"command used to show differences between script installed and the new "
+"version in repository (\"auto\" = auto detect diff command (git or diff), "
+"empty value = disable diff, other string = name of command, for example "
+"\"diff\")"
+msgstr ""
+
msgid ""
"display source code of script on buffer with detail on a script (script is "
"downloaded in a temporary file when detail on script is displayed)"
diff --git a/po/de.po b/po/de.po
index f37d75bfe..cc333313d 100644
--- a/po/de.po
+++ b/po/de.po
@@ -23,7 +23,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2012-08-28 16:36+0200\n"
+"POT-Creation-Date: 2012-08-30 08:37+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <weechatter@arcor.de>\n"
@@ -8869,13 +8869,13 @@ msgstr "WeeChat beenden"
msgid "Max WeeChat"
msgstr "WeeChat beenden"
-msgid "alt+d=back to list"
+msgid "Alt+key/input: v=back to list d=jump to diff"
msgstr ""
#, c-format
msgid ""
"%d/%d scripts (filter: %s) | Sort: %s | Alt+key/input: i=install r=remove "
-"l=load L=reload u=unload h=(un)hold d=show detail | Input: q=close $=refresh "
+"l=load L=reload u=unload h=(un)hold v=view script | Input: q=close $=refresh "
"s:x,y=sort words=filter *=reset filter | Mouse: left=select right=install/"
"remove"
msgstr ""
@@ -8933,6 +8933,7 @@ msgid ""
" alt+L reload script\n"
" alt+u unload script\n"
" alt+h (un)hold script\n"
+" alt+v view script\n"
"\n"
"Input allowed on script buffer:\n"
" i/r/l/L/u/h action on script (same as keys above)\n"
@@ -8980,6 +8981,16 @@ msgid ""
"loaded, %w=min_weechat, %W=max_weechat)"
msgstr ""
+msgid "colorize output of diff"
+msgstr ""
+
+msgid ""
+"command used to show differences between script installed and the new "
+"version in repository (\"auto\" = auto detect diff command (git or diff), "
+"empty value = disable diff, other string = name of command, for example "
+"\"diff\")"
+msgstr ""
+
msgid ""
"display source code of script on buffer with detail on a script (script is "
"downloaded in a temporary file when detail on script is displayed)"
diff --git a/po/es.po b/po/es.po
index f8e8c7ef0..2df5018c9 100644
--- a/po/es.po
+++ b/po/es.po
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2012-08-28 16:36+0200\n"
+"POT-Creation-Date: 2012-08-30 08:37+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -8570,13 +8570,13 @@ msgstr "cerrar WeeChat"
msgid "Max WeeChat"
msgstr "cerrar WeeChat"
-msgid "alt+d=back to list"
+msgid "Alt+key/input: v=back to list d=jump to diff"
msgstr ""
#, c-format
msgid ""
"%d/%d scripts (filter: %s) | Sort: %s | Alt+key/input: i=install r=remove "
-"l=load L=reload u=unload h=(un)hold d=show detail | Input: q=close $=refresh "
+"l=load L=reload u=unload h=(un)hold v=view script | Input: q=close $=refresh "
"s:x,y=sort words=filter *=reset filter | Mouse: left=select right=install/"
"remove"
msgstr ""
@@ -8634,6 +8634,7 @@ msgid ""
" alt+L reload script\n"
" alt+u unload script\n"
" alt+h (un)hold script\n"
+" alt+v view script\n"
"\n"
"Input allowed on script buffer:\n"
" i/r/l/L/u/h action on script (same as keys above)\n"
@@ -8681,6 +8682,16 @@ msgid ""
"loaded, %w=min_weechat, %W=max_weechat)"
msgstr ""
+msgid "colorize output of diff"
+msgstr ""
+
+msgid ""
+"command used to show differences between script installed and the new "
+"version in repository (\"auto\" = auto detect diff command (git or diff), "
+"empty value = disable diff, other string = name of command, for example "
+"\"diff\")"
+msgstr ""
+
msgid ""
"display source code of script on buffer with detail on a script (script is "
"downloaded in a temporary file when detail on script is displayed)"
diff --git a/po/fr.po b/po/fr.po
index db12600da..778f38506 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2012-08-28 16:36+0200\n"
-"PO-Revision-Date: 2012-08-28 15:43+0200\n"
+"POT-Creation-Date: 2012-08-30 08:37+0200\n"
+"PO-Revision-Date: 2012-08-29 17:56+0200\n"
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: French\n"
@@ -8642,19 +8642,19 @@ msgstr "WeeChat mini"
msgid "Max WeeChat"
msgstr "WeeChat maxi"
-msgid "alt+d=back to list"
-msgstr "alt+d=retour à la liste"
+msgid "Alt+key/input: v=back to list d=jump to diff"
+msgstr "Alt+touche/entrée: v=retour à la liste d=sauter au diff"
#, c-format
msgid ""
"%d/%d scripts (filter: %s) | Sort: %s | Alt+key/input: i=install r=remove "
-"l=load L=reload u=unload h=(un)hold d=show detail | Input: q=close $=refresh "
+"l=load L=reload u=unload h=(un)hold v=view script | Input: q=close $=refresh "
"s:x,y=sort words=filter *=reset filter | Mouse: left=select right=install/"
"remove"
msgstr ""
"%d/%d scripts (filtre: %s) | Tri: %s | Alt+touche/entrée: i=installer "
-"r=supprimer l=charger L=recharger u=décharger h=(dé)figer d=afficher détail "
-"| Entrée: q=fermer $=rafraîchir s:x,y=trier words=filtrer *=réinit filtre | "
+"r=supprimer l=charger L=recharger u=décharger h=(dé)figer v=voir script | "
+"Entrée: q=fermer $=rafraîchir s:x,y=trier words=filtrer *=réinit filtre | "
"Souris: gauche=sélectionner droit=installer/supprimer"
msgid "Scripts"
@@ -8712,6 +8712,7 @@ msgid ""
" alt+L reload script\n"
" alt+u unload script\n"
" alt+h (un)hold script\n"
+" alt+v view script\n"
"\n"
"Input allowed on script buffer:\n"
" i/r/l/L/u/h action on script (same as keys above)\n"
@@ -8776,6 +8777,7 @@ msgstr ""
" alt+L recharger le script\n"
" alt+u décharger le script\n"
" alt+h (dé)figer le script\n"
+" alt+v voir le script\n"
"\n"
"Entrée autorisée sur le tampon des scripts:\n"
" i/r/l/L/u/h action sur le script (identique aux touches ci-dessus)\n"
@@ -8827,6 +8829,20 @@ msgstr ""
"%u=date de mise à jour, %v=version, %V=version chargée, %w=min_weechat, "
"%W=max_weechat"
+msgid "colorize output of diff"
+msgstr "colorie la sortie du diff"
+
+msgid ""
+"command used to show differences between script installed and the new "
+"version in repository (\"auto\" = auto detect diff command (git or diff), "
+"empty value = disable diff, other string = name of command, for example "
+"\"diff\")"
+msgstr ""
+"commande utilisée pour montrer les différences entre le script installé et "
+"la nouvelle version dans le repository (\"auto\" = détecter automatiquement "
+"la commande de diff (git ou diff), valeur vide = désactiver le diff, autre "
+"chaîne = nom de la commande, par exemple \"diff\")"
+
msgid ""
"display source code of script on buffer with detail on a script (script is "
"downloaded in a temporary file when detail on script is displayed)"
@@ -9468,6 +9484,9 @@ msgstr "Type"
msgid "Constants"
msgstr "Constantes"
+#~ msgid "alt+v=back to list"
+#~ msgstr "alt+v=retour à la liste"
+
#~ msgid "%s: connecting to server %s/%d%s%s..."
#~ msgstr "%s: connexion au serveur %s/%d%s%s..."
diff --git a/po/hu.po b/po/hu.po
index 0d71c0678..7de965299 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2012-08-28 16:36+0200\n"
+"POT-Creation-Date: 2012-08-30 08:37+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -7776,13 +7776,13 @@ msgstr "WeeChat szlogen"
msgid "Max WeeChat"
msgstr "WeeChat szlogen"
-msgid "alt+d=back to list"
+msgid "Alt+key/input: v=back to list d=jump to diff"
msgstr ""
#, c-format
msgid ""
"%d/%d scripts (filter: %s) | Sort: %s | Alt+key/input: i=install r=remove "
-"l=load L=reload u=unload h=(un)hold d=show detail | Input: q=close $=refresh "
+"l=load L=reload u=unload h=(un)hold v=view script | Input: q=close $=refresh "
"s:x,y=sort words=filter *=reset filter | Mouse: left=select right=install/"
"remove"
msgstr ""
@@ -7840,6 +7840,7 @@ msgid ""
" alt+L reload script\n"
" alt+u unload script\n"
" alt+h (un)hold script\n"
+" alt+v view script\n"
"\n"
"Input allowed on script buffer:\n"
" i/r/l/L/u/h action on script (same as keys above)\n"
@@ -7887,6 +7888,16 @@ msgid ""
"loaded, %w=min_weechat, %W=max_weechat)"
msgstr ""
+msgid "colorize output of diff"
+msgstr ""
+
+msgid ""
+"command used to show differences between script installed and the new "
+"version in repository (\"auto\" = auto detect diff command (git or diff), "
+"empty value = disable diff, other string = name of command, for example "
+"\"diff\")"
+msgstr ""
+
msgid ""
"display source code of script on buffer with detail on a script (script is "
"downloaded in a temporary file when detail on script is displayed)"
diff --git a/po/it.po b/po/it.po
index 99e861376..506b6dd0f 100644
--- a/po/it.po
+++ b/po/it.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2012-08-28 16:36+0200\n"
+"POT-Creation-Date: 2012-08-30 08:37+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -8560,13 +8560,13 @@ msgstr "esce da WeeChat"
msgid "Max WeeChat"
msgstr "esce da WeeChat"
-msgid "alt+d=back to list"
+msgid "Alt+key/input: v=back to list d=jump to diff"
msgstr ""
#, c-format
msgid ""
"%d/%d scripts (filter: %s) | Sort: %s | Alt+key/input: i=install r=remove "
-"l=load L=reload u=unload h=(un)hold d=show detail | Input: q=close $=refresh "
+"l=load L=reload u=unload h=(un)hold v=view script | Input: q=close $=refresh "
"s:x,y=sort words=filter *=reset filter | Mouse: left=select right=install/"
"remove"
msgstr ""
@@ -8624,6 +8624,7 @@ msgid ""
" alt+L reload script\n"
" alt+u unload script\n"
" alt+h (un)hold script\n"
+" alt+v view script\n"
"\n"
"Input allowed on script buffer:\n"
" i/r/l/L/u/h action on script (same as keys above)\n"
@@ -8671,6 +8672,16 @@ msgid ""
"loaded, %w=min_weechat, %W=max_weechat)"
msgstr ""
+msgid "colorize output of diff"
+msgstr ""
+
+msgid ""
+"command used to show differences between script installed and the new "
+"version in repository (\"auto\" = auto detect diff command (git or diff), "
+"empty value = disable diff, other string = name of command, for example "
+"\"diff\")"
+msgstr ""
+
msgid ""
"display source code of script on buffer with detail on a script (script is "
"downloaded in a temporary file when detail on script is displayed)"
diff --git a/po/ja.po b/po/ja.po
index 17cdcc31b..3221ebf13 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2012-08-28 16:36+0200\n"
+"POT-Creation-Date: 2012-08-30 08:37+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/WeeChat>\n"
@@ -8359,13 +8359,13 @@ msgstr "WeeChat の終了"
msgid "Max WeeChat"
msgstr "WeeChat の終了"
-msgid "alt+d=back to list"
+msgid "Alt+key/input: v=back to list d=jump to diff"
msgstr ""
#, c-format
msgid ""
"%d/%d scripts (filter: %s) | Sort: %s | Alt+key/input: i=install r=remove "
-"l=load L=reload u=unload h=(un)hold d=show detail | Input: q=close $=refresh "
+"l=load L=reload u=unload h=(un)hold v=view script | Input: q=close $=refresh "
"s:x,y=sort words=filter *=reset filter | Mouse: left=select right=install/"
"remove"
msgstr ""
@@ -8423,6 +8423,7 @@ msgid ""
" alt+L reload script\n"
" alt+u unload script\n"
" alt+h (un)hold script\n"
+" alt+v view script\n"
"\n"
"Input allowed on script buffer:\n"
" i/r/l/L/u/h action on script (same as keys above)\n"
@@ -8470,6 +8471,16 @@ msgid ""
"loaded, %w=min_weechat, %W=max_weechat)"
msgstr ""
+msgid "colorize output of diff"
+msgstr ""
+
+msgid ""
+"command used to show differences between script installed and the new "
+"version in repository (\"auto\" = auto detect diff command (git or diff), "
+"empty value = disable diff, other string = name of command, for example "
+"\"diff\")"
+msgstr ""
+
msgid ""
"display source code of script on buffer with detail on a script (script is "
"downloaded in a temporary file when detail on script is displayed)"
diff --git a/po/pl.po b/po/pl.po
index 4a50b36f9..968988582 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2012-08-28 16:36+0200\n"
+"POT-Creation-Date: 2012-08-30 08:37+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -8493,13 +8493,13 @@ msgstr "zakończ WeeChat"
msgid "Max WeeChat"
msgstr "zakończ WeeChat"
-msgid "alt+d=back to list"
+msgid "Alt+key/input: v=back to list d=jump to diff"
msgstr ""
#, c-format
msgid ""
"%d/%d scripts (filter: %s) | Sort: %s | Alt+key/input: i=install r=remove "
-"l=load L=reload u=unload h=(un)hold d=show detail | Input: q=close $=refresh "
+"l=load L=reload u=unload h=(un)hold v=view script | Input: q=close $=refresh "
"s:x,y=sort words=filter *=reset filter | Mouse: left=select right=install/"
"remove"
msgstr ""
@@ -8557,6 +8557,7 @@ msgid ""
" alt+L reload script\n"
" alt+u unload script\n"
" alt+h (un)hold script\n"
+" alt+v view script\n"
"\n"
"Input allowed on script buffer:\n"
" i/r/l/L/u/h action on script (same as keys above)\n"
@@ -8604,6 +8605,16 @@ msgid ""
"loaded, %w=min_weechat, %W=max_weechat)"
msgstr ""
+msgid "colorize output of diff"
+msgstr ""
+
+msgid ""
+"command used to show differences between script installed and the new "
+"version in repository (\"auto\" = auto detect diff command (git or diff), "
+"empty value = disable diff, other string = name of command, for example "
+"\"diff\")"
+msgstr ""
+
msgid ""
"display source code of script on buffer with detail on a script (script is "
"downloaded in a temporary file when detail on script is displayed)"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index c6639b508..163302bcf 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2012-08-28 16:36+0200\n"
+"POT-Creation-Date: 2012-08-30 08:37+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -7927,13 +7927,13 @@ msgstr "quit WeeChat"
msgid "Max WeeChat"
msgstr "quit WeeChat"
-msgid "alt+d=back to list"
+msgid "Alt+key/input: v=back to list d=jump to diff"
msgstr ""
#, c-format
msgid ""
"%d/%d scripts (filter: %s) | Sort: %s | Alt+key/input: i=install r=remove "
-"l=load L=reload u=unload h=(un)hold d=show detail | Input: q=close $=refresh "
+"l=load L=reload u=unload h=(un)hold v=view script | Input: q=close $=refresh "
"s:x,y=sort words=filter *=reset filter | Mouse: left=select right=install/"
"remove"
msgstr ""
@@ -7991,6 +7991,7 @@ msgid ""
" alt+L reload script\n"
" alt+u unload script\n"
" alt+h (un)hold script\n"
+" alt+v view script\n"
"\n"
"Input allowed on script buffer:\n"
" i/r/l/L/u/h action on script (same as keys above)\n"
@@ -8038,6 +8039,16 @@ msgid ""
"loaded, %w=min_weechat, %W=max_weechat)"
msgstr ""
+msgid "colorize output of diff"
+msgstr ""
+
+msgid ""
+"command used to show differences between script installed and the new "
+"version in repository (\"auto\" = auto detect diff command (git or diff), "
+"empty value = disable diff, other string = name of command, for example "
+"\"diff\")"
+msgstr ""
+
msgid ""
"display source code of script on buffer with detail on a script (script is "
"downloaded in a temporary file when detail on script is displayed)"
diff --git a/po/ru.po b/po/ru.po
index b2b7486e3..c6bf6a3a6 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2012-08-28 16:36+0200\n"
+"POT-Creation-Date: 2012-08-30 08:37+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -7799,13 +7799,13 @@ msgstr "слоган WeeChat"
msgid "Max WeeChat"
msgstr "слоган WeeChat"
-msgid "alt+d=back to list"
+msgid "Alt+key/input: v=back to list d=jump to diff"
msgstr ""
#, c-format
msgid ""
"%d/%d scripts (filter: %s) | Sort: %s | Alt+key/input: i=install r=remove "
-"l=load L=reload u=unload h=(un)hold d=show detail | Input: q=close $=refresh "
+"l=load L=reload u=unload h=(un)hold v=view script | Input: q=close $=refresh "
"s:x,y=sort words=filter *=reset filter | Mouse: left=select right=install/"
"remove"
msgstr ""
@@ -7863,6 +7863,7 @@ msgid ""
" alt+L reload script\n"
" alt+u unload script\n"
" alt+h (un)hold script\n"
+" alt+v view script\n"
"\n"
"Input allowed on script buffer:\n"
" i/r/l/L/u/h action on script (same as keys above)\n"
@@ -7910,6 +7911,16 @@ msgid ""
"loaded, %w=min_weechat, %W=max_weechat)"
msgstr ""
+msgid "colorize output of diff"
+msgstr ""
+
+msgid ""
+"command used to show differences between script installed and the new "
+"version in repository (\"auto\" = auto detect diff command (git or diff), "
+"empty value = disable diff, other string = name of command, for example "
+"\"diff\")"
+msgstr ""
+
msgid ""
"display source code of script on buffer with detail on a script (script is "
"downloaded in a temporary file when detail on script is displayed)"
diff --git a/po/weechat.pot b/po/weechat.pot
index ec2e608d3..66a86a463 100644
--- a/po/weechat.pot
+++ b/po/weechat.pot
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2012-08-28 16:36+0200\n"
+"POT-Creation-Date: 2012-08-30 08:37+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -6849,13 +6849,13 @@ msgstr ""
msgid "Max WeeChat"
msgstr ""
-msgid "alt+d=back to list"
+msgid "Alt+key/input: v=back to list d=jump to diff"
msgstr ""
#, c-format
msgid ""
"%d/%d scripts (filter: %s) | Sort: %s | Alt+key/input: i=install r=remove "
-"l=load L=reload u=unload h=(un)hold d=show detail | Input: q=close $=refresh "
+"l=load L=reload u=unload h=(un)hold v=view script | Input: q=close $=refresh "
"s:x,y=sort words=filter *=reset filter | Mouse: left=select right=install/"
"remove"
msgstr ""
@@ -6912,6 +6912,7 @@ msgid ""
" alt+L reload script\n"
" alt+u unload script\n"
" alt+h (un)hold script\n"
+" alt+v view script\n"
"\n"
"Input allowed on script buffer:\n"
" i/r/l/L/u/h action on script (same as keys above)\n"
@@ -6957,6 +6958,16 @@ msgid ""
"loaded, %w=min_weechat, %W=max_weechat)"
msgstr ""
+msgid "colorize output of diff"
+msgstr ""
+
+msgid ""
+"command used to show differences between script installed and the new "
+"version in repository (\"auto\" = auto detect diff command (git or diff), "
+"empty value = disable diff, other string = name of command, for example "
+"\"diff\")"
+msgstr ""
+
msgid ""
"display source code of script on buffer with detail on a script (script is "
"downloaded in a temporary file when detail on script is displayed)"
diff --git a/src/plugins/script/script-action.c b/src/plugins/script/script-action.c
index 387dfea45..a55a87fdf 100644
--- a/src/plugins/script/script-action.c
+++ b/src/plugins/script/script-action.c
@@ -26,6 +26,8 @@
#include <string.h>
#include <stdio.h>
#include <libgen.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include "../weechat-plugin.h"
#include "script.h"
@@ -661,19 +663,114 @@ script_action_hold (const char *name, int quiet)
}
/*
- * script_action_show_process_cb: callback called when script is downloaded
- * (for showing source code below script detail)
+ * script_action_show_diff_process_cb: callback called when script is
+ * downloaded (for showing source code
+ * below script detail)
*/
int
-script_action_show_process_cb (void *data, const char *command,
- int return_code, const char *out,
- const char *err)
+script_action_show_diff_process_cb (void *data, const char *command,
+ int return_code, const char *out,
+ const char *err)
{
- char *pos, *filename, line[4096], *ptr_line;
+ char **lines, *filename;
+ const char *color;
+ int num_lines, i, diff_color;
+
+ /* make C compiler happy */
+ (void) command;
+
+ if (script_buffer && script_buffer_detail_script
+ && ((return_code == WEECHAT_HOOK_PROCESS_RUNNING) || (return_code >= 0)))
+ {
+ if (out)
+ {
+ lines = weechat_string_split (out, "\n", 0, 0, &num_lines);
+ if (lines)
+ {
+ diff_color = weechat_config_boolean (script_config_look_diff_color);
+ for (i = 0; i < num_lines; i++)
+ {
+ color = NULL;
+ if (diff_color)
+ {
+ switch (lines[i][0])
+ {
+ case '-':
+ case '<':
+ color = weechat_color ("red");
+ break;
+ case '+':
+ case '>':
+ color = weechat_color ("green");
+ break;
+ case '@':
+ color = weechat_color ("cyan");
+ break;
+ }
+ }
+ weechat_printf_y (script_buffer,
+ script_buffer_detail_script_last_line++,
+ "%s%s",
+ (color) ? color : "",
+ lines[i]);
+ }
+ weechat_string_free_split (lines);
+ }
+ }
+ else if (err)
+ {
+ lines = weechat_string_split (err, "\n", 0, 0, &num_lines);
+ if (lines)
+ {
+ for (i = 0; i < num_lines; i++)
+ {
+ weechat_printf_y (script_buffer,
+ script_buffer_detail_script_last_line++,
+ "%s",
+ lines[i]);
+ }
+ weechat_string_free_split (lines);
+ }
+ }
+ if (return_code >= 0)
+ {
+ weechat_printf_y (script_buffer,
+ script_buffer_detail_script_last_line++,
+ "%s----------------------------------------"
+ "----------------------------------------",
+ weechat_color ("magenta"));
+ }
+ }
+
+ if ((return_code == WEECHAT_HOOK_PROCESS_ERROR) || (return_code >= 0))
+ {
+ /* last call to this callback: delete temporary file */
+ filename = (char *)data;
+ unlink (filename);
+ free (filename);
+ }
+
+ return WEECHAT_RC_OK;
+}
+
+/*
+ * script_action_show_source_process_cb: callback called when script is
+ * downloaded (for showing source code
+ * below script detail)
+ */
+
+int
+script_action_show_source_process_cb (void *data, const char *command,
+ int return_code, const char *out,
+ const char *err)
+{
+ char *pos, *filename, *filename_loaded, line[4096], *ptr_line;
+ char *diff_command;
+ const char *ptr_diff_command;
struct t_repo_script *ptr_script;
FILE *file;
- int line_y;
+ int length, diff_made;
/* make C compiler happy */
(void) data;
@@ -699,7 +796,7 @@ script_action_show_process_cb (void *data, const char *command,
if (ptr_script)
{
filename = script_config_get_script_download_filename (ptr_script,
- ".tmp");
+ ".repository");
if (filename)
{
/*
@@ -710,7 +807,6 @@ script_action_show_process_cb (void *data, const char *command,
if (script_buffer && script_buffer_detail_script
&& (script_buffer_detail_script == ptr_script))
{
- line_y = script_buffer_detail_script_line_source + 2;
file = fopen (filename, "r");
if (file)
{
@@ -719,27 +815,74 @@ script_action_show_process_cb (void *data, const char *command,
ptr_line = fgets (line, sizeof (line) - 1, file);
if (ptr_line)
{
- weechat_printf_y (script_buffer, line_y,
+ weechat_printf_y (script_buffer,
+ script_buffer_detail_script_last_line++,
"%s", ptr_line);
- line_y++;
}
}
fclose (file);
}
else
{
- weechat_printf_y (script_buffer, line_y,
+ weechat_printf_y (script_buffer,
+ script_buffer_detail_script_last_line++,
_("Error: file not found"));
- line_y++;
}
- weechat_printf_y (script_buffer, line_y,
+ weechat_printf_y (script_buffer,
+ script_buffer_detail_script_last_line++,
"%s----------------------------------------"
"----------------------------------------",
- weechat_color ("green"));
- line_y++;
+ weechat_color ("lightcyan"));
+ }
+ diff_made = 0;
+ ptr_diff_command = script_config_get_diff_command ();
+ if (ptr_diff_command && ptr_diff_command[0]
+ && (ptr_script->status & SCRIPT_STATUS_NEW_VERSION))
+ {
+ /*
+ * diff command set => get the diff with a new process,
+ * file will be deleted later (in callback of this new
+ * process)
+ */
+ filename_loaded = script_repo_get_filename_loaded (ptr_script);
+ if (filename_loaded)
+ {
+ length = strlen (ptr_diff_command) + 1
+ + strlen (filename_loaded) + 1
+ + strlen (filename) + 1;
+ diff_command = malloc (length);
+ if (diff_command)
+ {
+ snprintf (diff_command, length,
+ "%s %s %s",
+ ptr_diff_command,
+ filename_loaded,
+ filename);
+ script_buffer_detail_script_last_line++;
+ script_buffer_detail_script_line_diff = script_buffer_detail_script_last_line;
+ weechat_printf_y (script_buffer,
+ script_buffer_detail_script_last_line++,
+ "%s", diff_command);
+ weechat_printf_y (script_buffer,
+ script_buffer_detail_script_last_line++,
+ "%s----------------------------------------"
+ "----------------------------------------",
+ weechat_color ("magenta"));
+ weechat_hook_process (diff_command, 10000,
+ &script_action_show_diff_process_cb,
+ filename);
+ diff_made = 1;
+ free (diff_command);
+ }
+ free (filename_loaded);
+ }
+ }
+ if (!diff_made)
+ {
+ /* no diff made: delete temporary file now */
+ unlink (filename);
+ free (filename);
}
- unlink (filename);
- free (filename);
}
}
}
@@ -769,23 +912,23 @@ script_action_show (const char *name, int quiet)
if (weechat_config_boolean (script_config_look_display_source))
{
weechat_printf_y (script_buffer,
- script_buffer_detail_script_line_source,
+ script_buffer_detail_script_last_line++,
_("Source code:"));
weechat_printf_y (script_buffer,
- script_buffer_detail_script_line_source + 1,
+ script_buffer_detail_script_last_line++,
"%s----------------------------------------"
"----------------------------------------",
- weechat_color ("green"));
+ weechat_color ("lightcyan"));
weechat_printf_y (script_buffer,
- script_buffer_detail_script_line_source + 2,
+ script_buffer_detail_script_last_line,
_("Downloading script..."));
weechat_printf_y (script_buffer,
- script_buffer_detail_script_line_source + 3,
+ script_buffer_detail_script_last_line + 1,
"%s----------------------------------------"
"----------------------------------------",
- weechat_color ("green"));
+ weechat_color ("lightcyan"));
filename = script_config_get_script_download_filename (ptr_script,
- ".tmp");
+ ".repository");
if (filename)
{
options = weechat_hashtable_new (8,
@@ -802,7 +945,7 @@ script_action_show (const char *name, int quiet)
snprintf (url, length, "url:%s", ptr_script->url);
weechat_hashtable_set (options, "file_out", filename);
weechat_hook_process_hashtable (url, options, 30000,
- &script_action_show_process_cb,
+ &script_action_show_source_process_cb,
NULL);
free (url);
}
@@ -827,6 +970,43 @@ script_action_show (const char *name, int quiet)
}
/*
+ * script_action_showdiff: jump to diff on buffer with detail of script
+ */
+
+void
+script_action_showdiff ()
+{
+ char str_command[64];
+ struct t_gui_window *window;
+ int diff, start_line_y, chat_height;
+
+ if (script_buffer && script_buffer_detail_script
+ && (script_buffer_detail_script_line_diff >= 0))
+ {
+ /* check if we are already on diff */
+ diff = 0;
+ window = weechat_window_search_with_buffer (script_buffer);
+ if (window)
+ {
+ script_buffer_get_window_info (window, &start_line_y, &chat_height);
+ diff = (start_line_y == script_buffer_detail_script_line_diff);
+ }
+
+ /* scroll to top of window */
+ weechat_command (script_buffer, "/window scroll_top");
+
+ /* if not currently on diff, jump to it */
+ if (!diff)
+ {
+ snprintf (str_command, sizeof (str_command),
+ "/window scroll %d",
+ script_buffer_detail_script_line_diff);
+ weechat_command (script_buffer, str_command);
+ }
+ }
+}
+
+/*
* script_action_run: run planned actions
* return 1 if an action was executed, otherwise 0
*/
@@ -1017,6 +1197,10 @@ script_action_run ()
quiet);
weechat_buffer_set (script_buffer, "display", "1");
}
+ else if (weechat_strcasecmp (argv[0], "showdiff") == 0)
+ {
+ script_action_showdiff ();
+ }
else if (weechat_strcasecmp (argv[0], "upgrade") == 0)
{
script_found = 0;
diff --git a/src/plugins/script/script-buffer.c b/src/plugins/script/script-buffer.c
index 239c8a01c..1be10b02e 100644
--- a/src/plugins/script/script-buffer.c
+++ b/src/plugins/script/script-buffer.c
@@ -36,7 +36,8 @@
struct t_gui_buffer *script_buffer = NULL;
int script_buffer_selected_line = 0;
struct t_repo_script *script_buffer_detail_script = NULL;
-int script_buffer_detail_script_line_source = 0;
+int script_buffer_detail_script_last_line = 0;
+int script_buffer_detail_script_line_diff = -1;
/*
@@ -475,7 +476,8 @@ script_buffer_display_detail_script (struct t_repo_script *script)
(script->max_weechat) ? script->max_weechat : "-");
line++;
- script_buffer_detail_script_line_source = line + 2;
+ script_buffer_detail_script_last_line = line + 2;
+ script_buffer_detail_script_line_diff = -1;
}
/*
@@ -502,14 +504,14 @@ script_buffer_refresh (int clear)
{
snprintf (str_title, sizeof (str_title),
"%s",
- _("alt+d=back to list"));
+ _("Alt+key/input: v=back to list d=jump to diff"));
}
else
{
snprintf (str_title, sizeof (str_title),
_("%d/%d scripts (filter: %s) | Sort: %s | "
"Alt+key/input: i=install r=remove l=load L=reload "
- "u=unload h=(un)hold d=show detail | Input: q=close "
+ "u=unload h=(un)hold v=view script | Input: q=close "
"$=refresh s:x,y=sort words=filter *=reset filter | "
"Mouse: left=select right=install/remove"),
script_repo_count_displayed,
@@ -704,14 +706,15 @@ int
script_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
const char *input_data)
{
- char *actions[][2] = { { "l", "load" },
- { "u", "unload" },
- { "L", "reload" },
- { "i", "install" },
- { "r", "remove" },
- { "h", "hold" },
- { "d", "show" },
- { NULL, NULL } };
+ char *actions[][2] = { { "l", "load" },
+ { "u", "unload" },
+ { "L", "reload" },
+ { "i", "install" },
+ { "r", "remove" },
+ { "h", "hold" },
+ { "v", "show" },
+ { "d", "showdiff" },
+ { NULL, NULL } };
char str_command[64];
int i;
@@ -811,14 +814,15 @@ script_buffer_set_callbacks ()
void
script_buffer_set_keys ()
{
- char *keys[][2] = { { "meta-l", "load" },
- { "meta-u", "unload" },
- { "meta-L", "reload" },
- { "meta-i", "install" },
- { "meta-r", "remove" },
- { "meta-h", "hold" },
- { "meta-d", "show" },
- { NULL, NULL } };
+ char *keys[][2] = { { "meta-l", "load" },
+ { "meta-u", "unload" },
+ { "meta-L", "reload" },
+ { "meta-i", "install" },
+ { "meta-r", "remove" },
+ { "meta-h", "hold" },
+ { "meta-v", "show" },
+ { "meta-d", "showdiff" },
+ { NULL, NULL } };
char str_key[64], str_command[64];
int i;
diff --git a/src/plugins/script/script-buffer.h b/src/plugins/script/script-buffer.h
index 7fbd1dfc5..407c66460 100644
--- a/src/plugins/script/script-buffer.h
+++ b/src/plugins/script/script-buffer.h
@@ -27,11 +27,14 @@ struct t_repo_script;
extern struct t_gui_buffer *script_buffer;
extern int script_buffer_selected_line;
extern struct t_repo_script *script_buffer_detail_script;
-extern int script_buffer_detail_script_line_source;
+extern int script_buffer_detail_script_last_line;
+extern int script_buffer_detail_script_line_diff;
extern void script_buffer_refresh (int clear);
extern void script_buffer_set_current_line (int line);
extern void script_buffer_show_detail_script (struct t_repo_script *script);
+extern void script_buffer_get_window_info (struct t_gui_window *window,
+ int *start_line_y, int *chat_height);
extern void script_buffer_check_line_outside_window ();
extern int script_buffer_window_scrolled_cb (void *data, const char *signal,
const char *type_data,
diff --git a/src/plugins/script/script-command.c b/src/plugins/script/script-command.c
index b92e3039b..6f3ae7d5d 100644
--- a/src/plugins/script/script-command.c
+++ b/src/plugins/script/script-command.c
@@ -89,8 +89,9 @@ script_command_action (struct t_gui_buffer *buffer, const char *action,
else if (script_buffer && (buffer == script_buffer))
{
/* action on current line of script buffer */
- if ((weechat_strcasecmp (action, "show") == 0)
- && script_buffer_detail_script)
+ if (script_buffer_detail_script
+ && ((weechat_strcasecmp (action, "show") == 0)
+ || (weechat_strcasecmp (action, "showdiff") == 0)))
{
/* if detail on script is displayed, back to list */
snprintf (str_action, sizeof (str_action),
@@ -183,7 +184,8 @@ script_command_script (void *data, struct t_gui_buffer *buffer, int argc,
|| (weechat_strcasecmp (argv[1], "remove") == 0)
|| (weechat_strcasecmp (argv[1], "installremove") == 0)
|| (weechat_strcasecmp (argv[1], "hold") == 0)
- || (weechat_strcasecmp (argv[1], "show") == 0))
+ || (weechat_strcasecmp (argv[1], "show") == 0)
+ || (weechat_strcasecmp (argv[1], "showdiff") == 0))
{
script_command_action (buffer,
argv[1],
@@ -318,7 +320,8 @@ script_command_init ()
" alt+l load script\n"
" alt+L reload script\n"
" alt+u unload script\n"
- " alt+h (un)hold script\n\n"
+ " alt+h (un)hold script\n"
+ " alt+v view script\n\n"
"Input allowed on script buffer:\n"
" i/r/l/L/u/h action on script (same as keys above)\n"
" q close buffer\n"
diff --git a/src/plugins/script/script-config.c b/src/plugins/script/script-config.c
index 92af46600..cedda6f42 100644
--- a/src/plugins/script/script-config.c
+++ b/src/plugins/script/script-config.c
@@ -22,8 +22,11 @@
*/
#include <stdlib.h>
+#include <unistd.h>
#include <stdio.h>
#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include "../weechat-plugin.h"
#include "script.h"
@@ -40,6 +43,8 @@ struct t_config_section *script_config_section_scripts = NULL;
/* script config, look section */
struct t_config_option *script_config_look_columns;
+struct t_config_option *script_config_look_diff_color;
+struct t_config_option *script_config_look_diff_command;
struct t_config_option *script_config_look_display_source;
struct t_config_option *script_config_look_quiet_actions;
struct t_config_option *script_config_look_sort;
@@ -84,6 +89,59 @@ struct t_config_option *script_config_scripts_url;
/*
+ * script_config_get_diff_command: get diff command
+ * if option is "auto", try to find git, and
+ * fallbacks on "diff" if not found
+ * return NULL if no diff command is set
+ */
+
+const char *
+script_config_get_diff_command ()
+{
+ const char *diff_command, *dir_separator;
+ static char result[64];
+ struct stat st;
+ char *path, **paths, bin[4096];
+ int num_paths, i, rc;
+
+ diff_command = weechat_config_string (script_config_look_diff_command);
+ if (!diff_command || !diff_command[0])
+ return NULL;
+
+ if (strcmp (diff_command, "auto") == 0)
+ {
+ dir_separator = weechat_info_get ("dir_separator", "");
+ path = getenv ("PATH");
+ result[0] = '\0';
+ if (dir_separator && path)
+ {
+ paths = weechat_string_split (path, ":", 0, 0, &num_paths);
+ if (paths)
+ {
+ for (i = 0; i < num_paths; i++)
+ {
+ snprintf (bin, sizeof (bin), "%s%s%s",
+ paths[i], dir_separator, "git");
+ rc = stat (bin, &st);
+ if ((rc == 0) && (S_ISREG(st.st_mode)))
+ {
+ snprintf (result, sizeof (result),
+ "git diff --no-index");
+ break;
+ }
+ }
+ weechat_string_free_split (paths);
+ }
+ }
+ if (!result[0])
+ snprintf (result, sizeof (result), "diff");
+ return result;
+ }
+
+ return diff_command;
+}
+
+/*
* script_config_get_dir: get local directory for script
* Note: result must be freed after use
*/
@@ -370,6 +428,21 @@ script_config_init ()
"%W=max_weechat)"),
NULL, 0, 0, "%s %n %V %v %u | %d | %t", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
+ script_config_look_diff_color = weechat_config_new_option (
+ script_config_file, ptr_section,
+ "diff_color", "boolean",
+ N_("colorize output of diff"),
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL);
+ script_config_look_diff_command = weechat_config_new_option (
+ script_config_file, ptr_section,
+ "diff_command", "string",
+ N_("command used to show differences between script installed and the "
+ "new version in repository (\"auto\" = auto detect diff command (git "
+ "or diff), empty value = disable diff, other string = name of "
+ "command, for example \"diff\")"),
+ NULL, 0, 0, "auto", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL);
script_config_look_display_source = weechat_config_new_option (
script_config_file, ptr_section,
"display_source", "boolean",
diff --git a/src/plugins/script/script-config.h b/src/plugins/script/script-config.h
index dcaded263..af54eed2b 100644
--- a/src/plugins/script/script-config.h
+++ b/src/plugins/script/script-config.h
@@ -25,6 +25,8 @@
struct t_repo_script;
extern struct t_config_option *script_config_look_columns;
+extern struct t_config_option *script_config_look_diff_color;
+extern struct t_config_option *script_config_look_diff_command;
extern struct t_config_option *script_config_look_display_source;
extern struct t_config_option *script_config_look_quiet_actions;
extern struct t_config_option *script_config_look_sort;
@@ -63,6 +65,7 @@ extern struct t_config_option *script_config_scripts_dir;
extern struct t_config_option *script_config_scripts_hold;
extern struct t_config_option *script_config_scripts_url;
+extern const char *script_config_get_diff_command ();
extern char *script_config_get_dir ();
extern char *script_config_get_xml_filename ();
extern char *script_config_get_script_download_filename (struct t_repo_script *script,
diff --git a/src/plugins/script/script-repo.c b/src/plugins/script/script-repo.c
index 4d5be3fe5..5b140eb63 100644
--- a/src/plugins/script/script-repo.c
+++ b/src/plugins/script/script-repo.c
@@ -23,6 +23,7 @@
#define _XOPEN_SOURCE 700
+#include <limits.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
@@ -147,6 +148,61 @@ script_repo_search_by_name_ext (const char *name_with_extension)
}
/*
+ * script_repo_get_filename_loaded: get filename of a loaded script
+ * (it returns name of file and not the link,
+ * if there is a symbolic to file)
+ * Note: result has to be free() after use
+ */
+
+char *
+script_repo_get_filename_loaded (struct t_repo_script *script)
+{
+ const char *weechat_home;
+ char *filename, resolved_path[PATH_MAX];
+ int length;
+ struct stat st;
+
+ weechat_home = weechat_info_get ("weechat_dir", NULL);
+ length = strlen (weechat_home) + strlen (script->name_with_extension) + 64;
+ filename = malloc (length);
+ if (filename)
+ {
+ snprintf (filename, length, "%s/%s/autoload/%s",
+ weechat_home,
+ script_language[script->language],
+ script->name_with_extension);
+ if (stat (filename, &st) != 0)
+ {
+ snprintf (filename, length, "%s/%s/%s",
+ weechat_home,
+ script_language[script->language],
+ script->name_with_extension);
+ if (stat (filename, &st) != 0)
+ {
+ filename[0] = '\0';
+ }
+ }
+ }
+
+ if (!filename[0])
+ {
+ free (filename);
+ return NULL;
+ }
+
+ if (realpath (filename, resolved_path))
+ {
+ if (strcmp (filename, resolved_path) != 0)
+ {
+ free (filename);
+ return strdup (resolved_path);
+ }
+ }
+
+ return filename;
+}
+
+/*
* script_repo_get_status_for_display: get status for display
* list is the codes of status to display
* (exemple: "*iaHrN" for all status)
diff --git a/src/plugins/script/script-repo.h b/src/plugins/script/script-repo.h
index 5f8b97298..588f5644f 100644
--- a/src/plugins/script/script-repo.h
+++ b/src/plugins/script/script-repo.h
@@ -64,6 +64,7 @@ extern int script_repo_script_valid (struct t_repo_script *script);
extern struct t_repo_script *script_repo_search_displayed_by_number (int number);
extern struct t_repo_script *script_repo_search_by_name (const char *name);
extern struct t_repo_script *script_repo_search_by_name_ext (const char *name_with_extension);
+extern char *script_repo_get_filename_loaded (struct t_repo_script *script);
extern const char *script_repo_get_status_for_display (struct t_repo_script *script,
const char *list,
int collapse);