* src/mod_roster.erl: Fixed bug with handling of roster set

stanzas that contains CDATA

* src/mod_irc/mod_irc_connection.erl (handle_info/3): Fixed
parsing of string that have "\n" line separators (not "\r\n")

SVN Revision: 79
This commit is contained in:
Alexey Shchepin 2003-02-20 17:12:03 +00:00
parent b704efd553
commit 8664881c8f
3 changed files with 17 additions and 10 deletions

View File

@ -1,3 +1,11 @@
2003-02-20 Alexey Shchepin <alexey@sevcom.net>
* src/mod_roster.erl: Fixed bug with handling of roster set
stanzas that contains CDATA
* src/mod_irc/mod_irc_connection.erl (handle_info/3): Fixed
parsing of string that have "\n" line separators (not "\r\n")
2003-02-18 Alexey Shchepin <alexey@sevcom.net>
* src/mod_irc/: Added support for private chats, nicks changes and

View File

@ -365,7 +365,7 @@ handle_info({send_element, El}, StateName, StateData) ->
end;
handle_info({tcp, Socket, Data}, StateName, StateData) ->
Buf = StateData#state.inbuf ++ binary_to_list(Data),
{ok, Strings} = regexp:split(Buf, "\r\n"),
{ok, Strings} = regexp:split([C || C <- Buf, C /= $\r], "\n"),
io:format("strings=~p~n", [Strings]),
NewBuf = process_lines(Strings),
{next_state, StateName, StateData#state{inbuf = NewBuf}};

View File

@ -125,9 +125,7 @@ process_iq_set(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
lists:foreach(fun(El) -> process_item_set(User, From, To, El) end, Els),
{iq, ID, result, XMLNS, []}.
process_item_set(User, From, To, XItem) ->
{xmlelement, Name, Attrs, Els} = XItem,
% TODO: load existing item
process_item_set(User, From, To, {xmlelement, Name, Attrs, Els} = XItem) ->
JID = jlib:string_to_jid(xml:get_attr_s("jid", Attrs)),
LUser = jlib:tolower(User),
case JID of
@ -199,7 +197,9 @@ process_item_set(User, From, To, XItem) ->
?DEBUG("ROSTER: roster item set error: ~p~n", [E]),
ok
end
end.
end;
process_item_set(User, From, To, _) ->
ok.
process_item_attrs(Item, [{Attr, Val} | Attrs]) ->
case Attr of
@ -231,7 +231,6 @@ process_item_attrs(Item, []) ->
Item.
% {user, jid, name, subscription, groups, xattrs, xs}
process_item_els(Item, [{xmlelement, Name, Attrs, SEls} | Els]) ->
case Name of
"group" ->
@ -480,8 +479,7 @@ set_items(User, SubEl) ->
end,
mnesia:transaction(F).
process_item_set_t(User, XItem) ->
{xmlelement, Name, Attrs, Els} = XItem,
process_item_set_t(User, {xmlelement, Name, Attrs, Els} = XItem) ->
JID = jlib:string_to_jid(xml:get_attr_s("jid", Attrs)),
LUser = jlib:tolower(User),
case JID of
@ -501,8 +499,9 @@ process_item_set_t(User, XItem) ->
_ ->
mnesia:write(Item2)
end
end.
end;
process_item_set_t(User, _) ->
ok.
process_item_attrs_ws(Item, [{Attr, Val} | Attrs]) ->
case Attr of