First, the XMPP server is based on Ejabberd. Offline message module is Mod_interact, the original address: https://github.com/adamvduke/mod_interact; Implement group chat offline message after modification: https://github.com/Joywok/mod_interact
Not only to modify this file, but also related to Ehabberd_sm, Mod_muc_room, mod_offline three module modification.
The above three files only need to block or modify a few lines of code can be achieved, very simple.
EHABBERD_SM block the following two lines of code:
| 12 |
<<"groupchat">> ->bounce_offline_message(From, To, Packet); |
Mod_offline:
Modify the following line of code
| 1 |
if(Type /= <<"error">>) and (Type /= <<"groupchat">>) |
Modified by:
| 1 |
if(Type /= <<"error">>) |
Mod_muc_room This module to modify a few lines, MUC just to the online users to send messages, then the user is not on the line to receive, so in the sending of the message that the user is sent online repair to the members of the MUC OK.
Modify one of the following traversal codes:
| 123456789 |
lists:foreach( fun({_LJID, Info}) -> ejabberd_router:route( jlib:jid_replace_resource(StateData#state.jid,FromNick),Info#user.jid, Packet) end,?DICT:to_list(StateData#state.users)), |
The Modified code:
| 123456789101112 |
lists:foreach( fun(Info) -> {Jid,_} = Info,{Email,Server,Source}=Jid,To={‘jid‘,Email,Server,Source,Email,Server,Source},ejabberd_router:route(jlib:jid_replace_resource( StateData#state.jid,FromNick),To,Packet)end,?DICT:to_list(StateData#state.affiliations)), |
Recompile the module, replace the original module, restart the Ejabberd server is OK.
Following this will make it easy to implement group chat offline messages.
Original link: http://www.cnblogs.com/lovechengcheng/p/4083398.html
Ejabberd Chat Room Offline message