mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 21:36:29 +03:00
fix #164 add MEMBER_REMOVED event and member_removed plugin python hook
This commit is contained in:
22
src/chat.rs
22
src/chat.rs
@@ -1953,20 +1953,22 @@ pub(crate) fn add_contact_to_chat_ex(
|
||||
msg.param.set_cmd(SystemMessage::MemberAddedToGroup);
|
||||
msg.param.set(Param::Arg, contact.get_addr());
|
||||
msg.param.set_int(Param::Arg2, from_handshake.into());
|
||||
|
||||
msg.id = send_msg(context, chat_id, &mut msg)?;
|
||||
context.call_cb(Event::MsgsChanged {
|
||||
chat_id,
|
||||
msg_id: msg.id,
|
||||
});
|
||||
// send_msg sends MsgsChanged event
|
||||
// so we only send an explicit MemberAdded one
|
||||
context.call_cb(Event::MemberAdded {
|
||||
chat_id,
|
||||
contact_id: contact.id,
|
||||
});
|
||||
} else {
|
||||
// send an event for unpromoted groups
|
||||
// XXX probably not neccessary because ChatModified should suffice
|
||||
context.call_cb(Event::MsgsChanged {
|
||||
chat_id,
|
||||
msg_id: MsgId::new(0),
|
||||
});
|
||||
}
|
||||
context.call_cb(Event::MsgsChanged {
|
||||
chat_id,
|
||||
msg_id: MsgId::new(0),
|
||||
});
|
||||
context.call_cb(Event::ChatModified(chat_id));
|
||||
Ok(true)
|
||||
}
|
||||
@@ -2171,6 +2173,10 @@ pub fn remove_contact_from_chat(
|
||||
msg.param.set_cmd(SystemMessage::MemberRemovedFromGroup);
|
||||
msg.param.set(Param::Arg, contact.get_addr());
|
||||
msg.id = send_msg(context, chat_id, &mut msg)?;
|
||||
context.call_cb(Event::MemberRemoved {
|
||||
chat_id,
|
||||
contact_id: contact.id,
|
||||
});
|
||||
context.call_cb(Event::MsgsChanged {
|
||||
chat_id,
|
||||
msg_id: msg.id,
|
||||
|
||||
Reference in New Issue
Block a user