Skip to content
Browse files

Refactored to further cleanup xml_message, will be able to use loop_c…

…arrier for other methods later.
  • Loading branch information...
1 parent e888aa1 commit f2676fae63185fc5cb5551594177459b0c01566d @baphled committed
Showing with 10 additions and 7 deletions.
  1. +10 −7 lib/chatterl/src/chatterl_gateway.erl
View
17 lib/chatterl/src/chatterl_gateway.erl
@@ -302,22 +302,25 @@ to_json(Record) ->
%%
%% @end
%%--------------------------------------------------------------------
-xml_message(Record) ->
- {carrier, MessageType, Message} = Record,
+xml_message(CarrierRecord) ->
+ {carrier, MessageType, Message} = CarrierRecord,
case Message of
- {carrier, Type, Result} ->
+ {carrier, Type, Record} ->
case Type of
"groups" ->
- TempData = [result_xml_tuple(DataType,Data) || {carrier,DataType,Data} <- Result],
- [ResultList] = TempData,
- tuple_to_xml(xml_tuple(Type,ResultList),[]);
+ RecordList = loop_carrier(Record),
+ tuple_to_xml(xml_tuple(Type,RecordList),[]);
"error" ->
- tuple_to_xml(xml_tuple(Type,Result),[]);
+ tuple_to_xml(xml_tuple(Type,Record),[]);
_ -> io:format("dont know ~s~n",[Type])
end;
_ -> tuple_to_xml(xml_tuple(MessageType,Message),[])
end.
+loop_carrier(CarrierRecord) ->
+ TempData = [result_xml_tuple(DataType,Data) || {carrier,DataType,Data} <- CarrierRecord],
+ [ResultList] = TempData,
+ ResultList.
%%--------------------------------------------------------------------
%% @private
%% @doc

0 comments on commit f2676fa

Please sign in to comment.
Something went wrong with that request. Please try again.