Quantcast
Channel: Ignite Realtime : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 10742

Contact presence not working for transitions to “available” with GoogleTalk

$
0
0

Hi,

 

I don't receive messages for changes of Presence from my Gtalk contacts when they move to "available". If one contact passes from "available" to "dnd", I do receive a message. But not in the other way around. I receive no message.

 

Contact passes: "available" --> "dnd" --> "available" --> "dnd"
I receive:                   Presence{dnd}             Presence{dnd}

 

Whereas I expect to receive a Presence update {available} between the 2 dnd.

Since I receive presence updates except for "available" I suppose my listener works fine. Also I suppose I correctly subscribed to my contacts' presence...


private class FriendListener implements RosterListener {

    public void entriesAdded(Collection<String> addresses) { }
    public void entriesUpdated(Collection<String> addresses) { }
    public void entriesDeleted(Collection<String> addresses) { }

    public void presenceChanged(Presence presence) {
      String fromUserID = StringUtils.parseBareAddress(presence.getFrom());
      System.out.println(
        "Presence changed: " + fromUserID +
        " Presence=" + presence.toString() +
        " Type=" + presence.getType().toString() +
        " Mode=" + presence.getMode().toString()
      );
      mainCallback_.updatePresenceFriend(fromUserID, presence);
    }
  }

public void subscribe(String friendID, String friendName) {
  Presence presence = new Presence(Presence.Type.subscribe);
  connection.sendPacket(presence);

  RosterPacket rosterPacket = new RosterPacket();
  rosterPacket.setType(IQ.Type.SET);
  Item item = new Item(friendID, friendName);
  item.setItemType(RosterPacket.ItemType.both);
  rosterPacket.addRosterItem(item);

  connection.sendPacket(rosterPacket);
  System.out.println("Send subscribe to " + friendID);

  subscribedUsers.add(friendID);
}

 

 

Any idea?


Viewing all articles
Browse latest Browse all 10742

Trending Articles