forked from ermine/sulci
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin_userinfo_muc.ml
35 lines (31 loc) · 1.08 KB
/
plugin_userinfo_muc.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
(*
* (c) 2004-2010 Anastasia Gornostaeva
*)
open JID
open Muc
let status muc_context xmpp kind jid_from text =
if is_joined muc_context jid_from then
let entity =
if text = "" then jid_from.lresource
else Stringprep.resourceprep text
in
try
let item = Nicks.find entity (get_room_env from).nicks in
make_msg out xml ((if item.status = "" then ""
else item.status ^ " ") ^
"[" ^ (match item.show with
| `Online -> "online"
| `Away -> "away"
| `DND -> "dnd"
| `Chat -> "free for chat"
| `XA -> "xa") ^ "]")
with _ ->
make_msg out xml
(Lang.get_msg env.env_lang "plugin_userinfo_status_whose" [])
let plugin opts =
Muc.add_for_muc_context
(fun muc_context xmpp ->
Plugin_command.add_commands xmpp [("status", status)] opts
)
let () =
Plugin.add_plugin plugin