summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2017-06-03 15:42:05 +0200
committerSébastien Helleu <flashcode@flashtux.org>2017-06-03 15:42:05 +0200
commita195fa2af5b8ee29d891ce1053379275ad8eb15e (patch)
tree50596e97753ef14aad24e89634211cc5dcb28a6c
parentda8f19bcee8e59d9b9e4d392d7d0067988503b7f (diff)
downloadweechat-a195fa2af5b8ee29d891ce1053379275ad8eb15e.zip
doc: use WeeChat IRC message parsing function in IRC hook example (scripting guide)
-rw-r--r--doc/de/weechat_scripting.de.adoc8
-rw-r--r--doc/en/weechat_scripting.en.adoc7
-rw-r--r--doc/fr/weechat_scripting.fr.adoc7
-rw-r--r--doc/it/weechat_scripting.it.adoc7
-rw-r--r--doc/ja/weechat_scripting.ja.adoc7
-rw-r--r--doc/pl/weechat_scripting.pl.adoc7
6 files changed, 19 insertions, 24 deletions
diff --git a/doc/de/weechat_scripting.de.adoc b/doc/de/weechat_scripting.de.adoc
index 5aa261552..669f4f2be 100644
--- a/doc/de/weechat_scripting.de.adoc
+++ b/doc/de/weechat_scripting.de.adoc
@@ -1056,17 +1056,17 @@ xxxx,irc_in_yyy::
xxx,irc_in2_yyy::
Signal wird gesendet nachdem die Nachricht verarbeitet wurde.
+// TRANSLATION MISSING
[source,python]
----
def join_cb(data, signal, signal_data):
# Das Signal lautet: "freenode,irc_in2_join"
# signal_data enthält die IRC Nachricht, zum Beispiel: ":nick!user@host JOIN :#channel"
- nick = weechat.info_get("irc_nick_from_host", signal_data)
server = signal.split(",")[0]
- channel = signal_data.split(":")[-1]
- buffer = weechat.info_get("irc_buffer", "%s,%s" % (server, channel))
+ msg = weechat.info_get_hashtable("irc_message_parse", {"message": signal_data})
+ buffer = weechat.info_get("irc_buffer", "%s,%s" % (server, msg["channel"]))
if buffer:
- weechat.prnt(buffer, "Holla, %s hat den Channel betreten!" % nick)
+ weechat.prnt(buffer, "%s (%s) has joined this channel!" % (msg["nick"], msg["host"]))
return weechat.WEECHAT_RC_OK
# es ist sinnvoll als Server "*" anzugeben um alle JOIN Nachrichten von allen
diff --git a/doc/en/weechat_scripting.en.adoc b/doc/en/weechat_scripting.en.adoc
index 871ee8101..071aca80b 100644
--- a/doc/en/weechat_scripting.en.adoc
+++ b/doc/en/weechat_scripting.en.adoc
@@ -1039,12 +1039,11 @@ xxx,irc_in2_yyy::
def join_cb(data, signal, signal_data):
# signal is for example: "freenode,irc_in2_join"
# signal_data is IRC message, for example: ":nick!user@host JOIN :#channel"
- nick = weechat.info_get("irc_nick_from_host", signal_data)
server = signal.split(",")[0]
- channel = signal_data.split(":")[-1]
- buffer = weechat.info_get("irc_buffer", "%s,%s" % (server, channel))
+ msg = weechat.info_get_hashtable("irc_message_parse", {"message": signal_data})
+ buffer = weechat.info_get("irc_buffer", "%s,%s" % (server, msg["channel"]))
if buffer:
- weechat.prnt(buffer, "Eheh, %s has joined this channel!" % nick)
+ weechat.prnt(buffer, "%s (%s) has joined this channel!" % (msg["nick"], msg["host"]))
return weechat.WEECHAT_RC_OK
# it is useful here to use "*" as server, to catch JOIN messages on all IRC
diff --git a/doc/fr/weechat_scripting.fr.adoc b/doc/fr/weechat_scripting.fr.adoc
index afb504182..45306cec6 100644
--- a/doc/fr/weechat_scripting.fr.adoc
+++ b/doc/fr/weechat_scripting.fr.adoc
@@ -1063,12 +1063,11 @@ xxx,irc_in2_yyy::
def join_cb(data, signal, signal_data):
# signal est par exemple : "freenode,irc_in2_join"
# signal_data est le message IRC, par exemple : ":nick!user@host JOIN :#canal"
- nick = weechat.info_get("irc_nick_from_host", signal_data)
server = signal.split(",")[0]
- channel = signal_data.split(":")[-1]
- buffer = weechat.info_get("irc_buffer", "%s,%s" % (server, channel))
+ msg = weechat.info_get_hashtable("irc_message_parse", {"message": signal_data})
+ buffer = weechat.info_get("irc_buffer", "%s,%s" % (server, msg["channel"]))
if buffer:
- weechat.prnt(buffer, "Eheh, %s a rejoint le canal !" % nick)
+ weechat.prnt(buffer, "%s (%s) a rejoint ce canal !" % (msg["nick"], msg["host"]))
return weechat.WEECHAT_RC_OK
# il est pratique ici d'utiliser "*" comme serveur, pour intercepter les
diff --git a/doc/it/weechat_scripting.it.adoc b/doc/it/weechat_scripting.it.adoc
index f6e5cbe21..46f357d13 100644
--- a/doc/it/weechat_scripting.it.adoc
+++ b/doc/it/weechat_scripting.it.adoc
@@ -1066,12 +1066,11 @@ xxx,irc_in2_yyy::
def join_cb(data, signal, signal_data):
# signal è per esempio: "freenode,irc_in2_join"
# signal_data è il messaggio IRC message, ad esempio: ":nick!user@host JOIN :#channel"
- nick = weechat.info_get("irc_nick_from_host", signal_data)
server = signal.split(",")[0]
- channel = signal_data.split(":")[-1]
- buffer = weechat.info_get("irc_buffer", "%s,%s" % (server, channel))
+ msg = weechat.info_get_hashtable("irc_message_parse", {"message": signal_data})
+ buffer = weechat.info_get("irc_buffer", "%s,%s" % (server, msg["channel"]))
if buffer:
- weechat.prnt(buffer, "Eheh, %s has joined this channel!" % nick)
+ weechat.prnt(buffer, "%s (%s) has joined this channel!" % (msg["nick"], msg["host"]))
return weechat.WEECHAT_RC_OK
# può essere utile qui utilizzare "*" come server, per catturare
diff --git a/doc/ja/weechat_scripting.ja.adoc b/doc/ja/weechat_scripting.ja.adoc
index 8b7ac4c6a..998e6ec62 100644
--- a/doc/ja/weechat_scripting.ja.adoc
+++ b/doc/ja/weechat_scripting.ja.adoc
@@ -1047,12 +1047,11 @@ xxx,irc_in2_yyy::
def join_cb(data, signal, signal_data):
# シグナル、例えば: "freenode,irc_in2_join"
# signal_data は IRC メッセージ、例えば: ":nick!user@host JOIN :#channel"
- nick = weechat.info_get("irc_nick_from_host", signal_data)
server = signal.split(",")[0]
- channel = signal_data.split(":")[-1]
- buffer = weechat.info_get("irc_buffer", "%s,%s" % (server, channel))
+ msg = weechat.info_get_hashtable("irc_message_parse", {"message": signal_data})
+ buffer = weechat.info_get("irc_buffer", "%s,%s" % (server, msg["channel"]))
if buffer:
- weechat.prnt(buffer, "Eheh, %s has joined this channel!" % nick)
+ weechat.prnt(buffer, "%s (%s) has joined this channel!" % (msg["nick"], msg["host"]))
return weechat.WEECHAT_RC_OK
# 全ての IRC サーバに対する JOIN メッセージをキャッチするにはサーバの指定に
diff --git a/doc/pl/weechat_scripting.pl.adoc b/doc/pl/weechat_scripting.pl.adoc
index 7f4b21b36..64ec1a5de 100644
--- a/doc/pl/weechat_scripting.pl.adoc
+++ b/doc/pl/weechat_scripting.pl.adoc
@@ -1043,12 +1043,11 @@ xxx,irc_in2_yyy::
def join_cb(data, sygnał, signal_data):
# sygnał to na przykład: "freenode,irc_in2_join"
# signal_data to wiadomość IRC, na przykład: ":nick!user@host JOIN :#channel"
- nick = weechat.info_get("irc_nick_from_host", signal_data)
server = signal.split(",")[0]
- channel = signal_data.split(":")[-1]
- buffer = weechat.info_get("irc_buffer", "%s,%s" % (server, channel))
+ msg = weechat.info_get_hashtable("irc_message_parse", {"message": signal_data})
+ buffer = weechat.info_get("irc_buffer", "%s,%s" % (server, msg["channel"]))
if buffer:
- weechat.prnt(buffer, "Eheh, %s has joined this channel!" % nick)
+ weechat.prnt(buffer, "%s (%s) has joined this channel!" % (msg["nick"], msg["host"]))
return weechat.WEECHAT_RC_OK
# przydatne jest użycie "*" jako serwera, aby złapać wiadomość JOIN na wszystkich