anchor.diff:      TmpPacket2 = exmpp_xml:set_attribute(TmpPacket, to, From),
       NewPacket = exmpp_xml:remove_attribute(TmpPacket2, id),
       exmpp_session:send_packet(MySession, NewPacket).
  +
  +
  +playdar_capable({_User, _Domain, Resource} = _Jid) ->
  +	R = binary_to_list(Resource),
  +	string:str(R, "playdar") /= 0.
positive.code:     exmpp_session:send_packet(State#state.session, Presence1),
      {noreply, State}.
  
  handle_info(Rec = #received_packet{packet_type=presence, from=From, raw_packet=Packet}, State) ->
      case Rec#received_packet.type_attr of
          "unavailable" ->
              io:format("OFFLINE ~p~n",[From]);
          "available" -> 
              io:format("ONLINE ~p~n",[From]);
          X ->
              io:format("UNKNOWN PRESENCE ~p ~p~n",[X, From])
      end,
      {noreply, State};
              
  handle_info(Record = #received_packet{packet_type=message, raw_packet=Packet}, State) ->
      case exmpp_message:get_body(Packet) of
          undefined -> foo;
          Body -> io:format("RCV Chat msg body: ~p~n", [Body]),
  
negative.code: -include("playdar.hrl").
  
  %% API
  -export([start_link/0, peers/0, send_msg/2]).
  
  %% gen_server callbacks
  -export([init/1, handle_call/3, handle_cast/2, handle_info/2,
       terminate/2, code_change/3]).
  
  % peers is a list of JIDs of playdar-compatible peers only, not people on IM clients
  -record(state, {session, jid, peers}).
  
  %% API
  start_link() ->
      gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
  
  peers() -> gen_server:call(?MODULE, peers).
  
  send_msg(Jid, Msg) when is_list(Msg)   -> send_msg(Jid, list_to_binary(Msg));
  send_msg(Jid, Msg) when is_binary(Msg) -> gen_server:call(?MODULE, {send_msg, Jid, Msg}).
  
  %% gen_server callbacks
  init([]) ->
      application:start(exmpp),
      Session = exmpp_session:start(),
      JID = exmpp_jid:make(?CONFVAL({jabber,username}, undefined),
                           ?CONFVAL({jabber,domain}, undefined),
                           "playdar-"++integer_to_list(random:uniform(100000000))),
      exmpp_session:auth_basic(Session, JID, ?CONFVAL({jabber, password}, undefined)),
      _StreamId = exmpp_session:connect_TCP(Session, ?CONFVAL({jabber,domain}, undefined), 5222),
      gen_server:cast(?MODULE, do_login),
  	Peersdb = ets:new(peers,[]),
      {ok, #state{session=Session, jid=JID, peers=Peersdb}}.
  
  handle_call(peers, _From, State) ->
  	R = [ Jid || {Jid, _} <- ets:tab2list(State#state.peers) ],
  	{reply, R, State};
  
  handle_call({send_msg, Jid, Msg}, _From, State) ->
  	M  = exmpp_message:normal(Msg),
  	M2 = exmpp_stanza:set_recipient(M, exmpp_jid:make(Jid)),
  	M3 = exmpp_stanza:set_sender(M2, State#state.jid), 
  	exmpp_session:send_packet(State#state.session, M3),
  	{reply, ok, State};
  
  handle_call(_Request, _From, State) ->
      Reply = ok,
  