summaryrefslogtreecommitdiff
path: root/doc/en/weechat_scripting.en.adoc
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 /doc/en/weechat_scripting.en.adoc
parentda8f19bcee8e59d9b9e4d392d7d0067988503b7f (diff)
downloadweechat-a195fa2af5b8ee29d891ce1053379275ad8eb15e.zip
doc: use WeeChat IRC message parsing function in IRC hook example (scripting guide)
Diffstat (limited to 'doc/en/weechat_scripting.en.adoc')
-rw-r--r--doc/en/weechat_scripting.en.adoc7
1 files changed, 3 insertions, 4 deletions
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