summaryrefslogtreecommitdiff
path: root/doc/en/weechat_scripting.en.asciidoc
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2015-06-27 17:00:53 +0200
committerSébastien Helleu <flashcode@flashtux.org>2015-06-27 17:00:53 +0200
commit0ff8d7b5439ee543fae8eb4c4080ec4ccf905b1d (patch)
tree479fea1510aa2cbedf41ef2bb115e552d08f5995 /doc/en/weechat_scripting.en.asciidoc
parentfdd9c03e5a5670d6ecfa4d389df4e76d22fd3aad (diff)
downloadweechat-0ff8d7b5439ee543fae8eb4c4080ec4ccf905b1d.zip
irc: decode/encode only text in IRC messages and not the headers (bug #29886, closes #218, closes #451)
Diffstat (limited to 'doc/en/weechat_scripting.en.asciidoc')
-rw-r--r--doc/en/weechat_scripting.en.asciidoc66
1 files changed, 60 insertions, 6 deletions
diff --git a/doc/en/weechat_scripting.en.asciidoc b/doc/en/weechat_scripting.en.asciidoc
index b8864a26d..3fc5e5f12 100644
--- a/doc/en/weechat_scripting.en.asciidoc
+++ b/doc/en/weechat_scripting.en.asciidoc
@@ -899,14 +899,68 @@ _New in version 0.3.4._
You can parse an IRC message with info_hashtable called "irc_message_parse".
+The result is a hashtable with following keys
+(the example values are built with this message:
+`@time=2015-06-27T16:40:35.000Z :nick!user@host PRIVMSG #weechat :hello!`):
+
+[width="100%",cols="1,^2,10,8",options="header"]
+|===
+| Key | WeeChat version | Description | Example
+
+| tags | ≥ 0.4.0 |
+ The tags in message (can be empty) |
+ `time=2015-06-27T16:40:35.000Z`
+
+| message_without_tags | ≥ 0.4.0 |
+ The message without the tags (the same as message if there are no tags) |
+ `:nick!user@host PRIVMSG #weechat :hello!`
+
+| nick | ≥ 0.3.4 |
+ The origin nick |
+ `nick`
+
+| host | ≥ 0.3.4 |
+ The origin host (includes the nick) |
+ `nick!user@host`
+
+| command | ≥ 0.3.4 |
+ The command ('PRIVMSG', 'NOTICE', ...) |
+ `PRIVMSG`
+
+| channel | ≥ 0.3.4 |
+ The target channel |
+ `#weechat`
+
+| arguments | ≥ 0.3.4 |
+ The command arguments (includes the channel) |
+ `#weechat :hello!`
+
+| text | ≥ 1.3 |
+ The text (for example user message) |
+ `hello!`
+
+| pos_text | ≥ 1.3 |
+ The index of text in message ("-1" if text was not found) |
+ `65`
+|===
+
[source,python]
----
-dict = weechat.info_get_hashtable("irc_message_parse",
- {"message": ":nick!user@host PRIVMSG #weechat :message here"})
-weechat.prnt("", "dict: %s" % dict)
-
-# output:
-# dict: {'nick': 'nick', 'host': 'nick!user@host', 'command': 'PRIVMSG', 'arguments': '#weechat :message here', 'channel': '#weechat'}
+dict = weechat.info_get_hashtable(
+ "irc_message_parse",
+ {"message": "@time=2015-06-27T16:40:35.000Z :nick!user@host PRIVMSG #weechat :hello!"})
+
+# dict == {
+# "tags": "time=2015-06-27T16:40:35.000Z",
+# "message_without_tags": ":nick!user@host PRIVMSG #weechat :hello!",
+# "nick": "nick",
+# "host": "nick!user@host",
+# "command": "PRIVMSG",
+# "channel": "#weechat",
+# "arguments": "#weechat :hello!",
+# "text": "hello!",
+# "pos_text": "65",
+# }
----
[[infos]]