away reply cleanup
This commit is contained in:
parent
b5bec6c601
commit
cdbb445319
|
@ -305,8 +305,10 @@ let on_privmsg_chan from chan =
|
||||||
|
|
||||||
let on_privmsg_user _from user =
|
let on_privmsg_user _from user =
|
||||||
match User.away user with
|
match User.away user with
|
||||||
| Some text -> Error (away (User.nick user) text)
|
| Some text ->
|
||||||
| None -> Ok (User.nick user, [`to_user user])
|
Error (away (User.nick user) text)
|
||||||
|
| None ->
|
||||||
|
Ok (User.nick user, [`to_user user])
|
||||||
|
|
||||||
let on_msg_privmsg t tgt txt =
|
let on_msg_privmsg t tgt txt =
|
||||||
let* me = require_registered t in
|
let* me = require_registered t in
|
||||||
|
@ -323,17 +325,18 @@ let on_msg_privmsg t tgt txt =
|
||||||
Router.relay msg ~from:me tgts;
|
Router.relay msg ~from:me tgts;
|
||||||
Ok ()
|
Ok ()
|
||||||
|
|
||||||
let on_msg_away t status =
|
let set_away t me status =
|
||||||
let* me = require_registered t in
|
|
||||||
if status <> User.away me then
|
if status <> User.away me then
|
||||||
begin
|
begin
|
||||||
let rpl = match status with
|
|
||||||
| None -> "305", ["You are no longer marked as being away"]
|
|
||||||
| Some _ -> "306", ["You have been marked as being away"]
|
|
||||||
in
|
|
||||||
User.set_away me status;
|
User.set_away me status;
|
||||||
reply t rpl
|
match status with
|
||||||
end;
|
| None -> reply t ("305", ["You are no longer marked as being away"])
|
||||||
|
| Some _ -> reply t ("306", ["You have been marked as being away"])
|
||||||
|
end
|
||||||
|
|
||||||
|
let on_msg_away t status =
|
||||||
|
let* me = require_registered t in
|
||||||
|
set_away t me status;
|
||||||
Ok ()
|
Ok ()
|
||||||
|
|
||||||
let list_names t me chan =
|
let list_names t me chan =
|
||||||
|
|
Loading…
Reference in New Issue