aboutsummaryrefslogtreecommitdiffstats
path: root/src/de/gultsch/chat/services/XmppConnectionService.java
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-02-07 02:57:36 +0100
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-02-07 02:57:36 +0100
commitcda1c2c3a12b4c18f13771dd4b58aab6e465176b (patch)
tree9f246adce16c0951f64f4233c4c0ad8d00d7c8e1 /src/de/gultsch/chat/services/XmppConnectionService.java
parentaa42eb544a1ebf99dc52d71c917b899d1fce628d (diff)
refresh contact list
Diffstat (limited to 'src/de/gultsch/chat/services/XmppConnectionService.java')
-rw-r--r--src/de/gultsch/chat/services/XmppConnectionService.java19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/de/gultsch/chat/services/XmppConnectionService.java b/src/de/gultsch/chat/services/XmppConnectionService.java
index c5477ae0..457c06b6 100644
--- a/src/de/gultsch/chat/services/XmppConnectionService.java
+++ b/src/de/gultsch/chat/services/XmppConnectionService.java
@@ -18,6 +18,7 @@ import de.gultsch.chat.xmpp.IqPacket;
import de.gultsch.chat.xmpp.MessagePacket;
import de.gultsch.chat.xmpp.OnIqPacketReceived;
import de.gultsch.chat.xmpp.OnMessagePacketReceived;
+import de.gultsch.chat.xmpp.OnPresencePacketReceived;
import de.gultsch.chat.xmpp.OnStatusChanged;
import de.gultsch.chat.xmpp.PresencePacket;
import de.gultsch.chat.xmpp.XmppConnection;
@@ -123,6 +124,18 @@ public class XmppConnectionService extends Service {
}
}
};
+
+ private OnPresencePacketReceived presenceListener = new OnPresencePacketReceived() {
+
+ @Override
+ public void onPresencePacketReceived(Account account, PresencePacket packet) {
+ String jid = packet.getAttribute("from");
+ String type = packet.getAttribute("type");
+ if (type==null) {
+ Log.d(LOGTAG,"online presence from "+jid);
+ }
+ }
+ };
public class XmppConnectionBinder extends Binder {
public XmppConnectionService getService() {
@@ -157,6 +170,7 @@ public class XmppConnectionService extends Service {
XmppConnection connection = new XmppConnection(account, pm);
connection.setOnMessagePacketReceivedListener(this.messageListener);
connection.setOnStatusChangedListener(this.statusListener);
+ connection.setOnPresencePacketReceivedListener(this.presenceListener);
Thread thread = new Thread(connection);
thread.start();
return connection;
@@ -185,8 +199,8 @@ public class XmppConnectionService extends Service {
databaseBackend.updateMessage(message);
}
- public void getRoster(final OnRosterFetchedListener listener) {
- List<Contact> contacts = databaseBackend.getContacts();
+ public void getRoster(Account account, final OnRosterFetchedListener listener) {
+ List<Contact> contacts = databaseBackend.getContacts(account);
if (listener != null) {
listener.onRosterFetched(contacts);
}
@@ -249,7 +263,6 @@ public class XmppConnectionService extends Service {
if (roster != null) {
for (Element item : roster.getChildren()) {
Contact contact;
- Log.d(LOGTAG, item.toString());
String name = item.getAttribute("name");
String jid = item.getAttribute("jid");
if (phoneContacts.containsKey(jid)) {