diff options
author | Alexey Shchepin <alexey@process-one.net> | 2003-02-21 19:52:15 +0000 |
---|---|---|
committer | Alexey Shchepin <alexey@process-one.net> | 2003-02-21 19:52:15 +0000 |
commit | c18826ad53478441d9757292c02985ce342a230e (patch) | |
tree | d43be40fc615a6531428a84597d96edc007b5763 /src/mod_irc | |
parent | * src/mod_roster.erl: Fixed bug with handling of roster set (diff) |
* src/mod_offline.erl: Now possible to unload this module
* src/ejabberd_sm.erl: Added checks to work correctly when
mod_offline not loaded
* src/ejabberd_c2s.erl: Likewise
* src/mod_register.erl: Added support for users removal
* src/ejabberd_auth.erl: Added function to remove user only if
specified password correct
* src/mod_irc/mod_irc_connection.erl: Fixed bug with changing
availability status, added processing of "QUIT" message
SVN Revision: 80
Diffstat (limited to 'src/mod_irc')
-rw-r--r-- | src/mod_irc/mod_irc_connection.erl | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/src/mod_irc/mod_irc_connection.erl b/src/mod_irc/mod_irc_connection.erl index 4b1ff009..8e9c88d2 100644 --- a/src/mod_irc/mod_irc_connection.erl +++ b/src/mod_irc/mod_irc_connection.erl @@ -190,14 +190,20 @@ handle_info({route_chan, Channel, Resource, "unsubscribe" -> StateData; "unsubscribed" -> StateData; _ -> + Nick = case Resource of + "" -> + StateData#state.nick; + _ -> + Resource + end, S1 = ?SEND(io_lib:format("NICK ~s\r\n" "JOIN #~s\r\n", - [Resource, Channel])), + [Nick, Channel])), case dict:is_key(Channel, S1#state.channels) of true -> - S1#state{nick = Resource}; + S1#state{nick = Nick}; _ -> - S1#state{nick = Resource, + S1#state{nick = Nick, channels = dict:store(Channel, ?SETS:new(), S1#state.channels)} @@ -311,6 +317,8 @@ handle_info({ircstring, [$: | String]}, StateName, StateData) -> StateData; [From, "PART", [$# | Chan] | _] -> process_part(StateData, Chan, From, String); + [From, "QUIT" | _] -> + process_quit(StateData, From, String); [From, "JOIN", Chan | _] -> process_join(StateData, Chan, From, String); [From, "MODE", [$# | Chan], "+o", Nick | _] -> @@ -606,6 +614,32 @@ process_part(StateData, Chan, From, String) -> end. +process_quit(StateData, From, String) -> + [FromUser | _] = string:tokens(From, "!"), + %Msg = lists:last(string:tokens(String, ":")), + NewChans = + dict:map( + fun(Chan, Ps) -> + case ?SETS:is_member(FromUser, Ps) of + true -> + ejabberd_router:route( + {lists:concat([Chan, "%", StateData#state.server]), + StateData#state.myname, FromUser}, + StateData#state.user, + {xmlelement, "presence", [{"type", "unavailable"}], + [{xmlelement, "x", [{"xmlns", ?NS_MUC_USER}], + [{xmlelement, "item", + [{"affiliation", "member"}, + {"role", "none"}], + []}]}]}), + remove_element(FromUser, Ps); + _ -> + Ps + end + end, StateData#state.channels), + StateData. + + process_join(StateData, Channel, From, String) -> [FromUser | _] = string:tokens(From, "!"), Chan = lists:subtract(Channel, ":#"), |