aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2015-08-23 08:27:05 +0200
committerDaniel Gultsch <daniel@gultsch.de>2015-08-23 08:27:05 +0200
commit1688b659654cb1f3f5d4e20e6e238aa15fe60c96 (patch)
treeac4eeef9badd33a68f0762fd5fc6337fc1b36abd /src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
parent496f531e2ef2cad5ff4dfb01ef0afe87c8b6b5c3 (diff)
don't make subsequent iq request when original stanza returned an error
Diffstat (limited to 'src/main/java/eu/siacs/conversations/services/XmppConnectionService.java')
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java43
1 files changed, 22 insertions, 21 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index b89de628..4811665b 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -871,28 +871,31 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
@Override
public void onIqPacketReceived(final Account account, final IqPacket packet) {
- final Element query = packet.query();
- final List<Bookmark> bookmarks = new CopyOnWriteArrayList<>();
- final Element storage = query.findChild("storage",
- "storage:bookmarks");
- if (storage != null) {
- for (final Element item : storage.getChildren()) {
- if (item.getName().equals("conference")) {
- final Bookmark bookmark = Bookmark.parse(item, account);
- bookmarks.add(bookmark);
- Conversation conversation = find(bookmark);
- if (conversation != null) {
- conversation.setBookmark(bookmark);
- } else if (bookmark.autojoin() && bookmark.getJid() != null) {
- conversation = findOrCreateConversation(
- account, bookmark.getJid(), true);
- conversation.setBookmark(bookmark);
- joinMuc(conversation);
+ if (packet.getType() == IqPacket.TYPE.RESULT) {
+ final Element query = packet.query();
+ final List<Bookmark> bookmarks = new CopyOnWriteArrayList<>();
+ final Element storage = query.findChild("storage", "storage:bookmarks");
+ if (storage != null) {
+ for (final Element item : storage.getChildren()) {
+ if (item.getName().equals("conference")) {
+ final Bookmark bookmark = Bookmark.parse(item, account);
+ bookmarks.add(bookmark);
+ Conversation conversation = find(bookmark);
+ if (conversation != null) {
+ conversation.setBookmark(bookmark);
+ } else if (bookmark.autojoin() && bookmark.getJid() != null) {
+ conversation = findOrCreateConversation(
+ account, bookmark.getJid(), true);
+ conversation.setBookmark(bookmark);
+ joinMuc(conversation);
+ }
}
}
}
+ account.setBookmarks(bookmarks);
+ } else {
+ Log.d(Config.LOGTAG,account.getJid().toBareJid()+": could not fetch bookmarks");
}
- account.setBookmarks(bookmarks);
}
};
sendIqPacket(account, iqPacket, callback);
@@ -1955,10 +1958,8 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
final IqPacket packet = XmppConnectionService.this.mIqGenerator
.publishAvatarMetadata(avatar);
sendIqPacket(account, packet, new OnIqPacketReceived() {
-
@Override
- public void onIqPacketReceived(Account account,
- IqPacket result) {
+ public void onIqPacketReceived(Account account, IqPacket result) {
if (result.getType() == IqPacket.TYPE.RESULT) {
if (account.setAvatar(avatar.getFilename())) {
getAvatarService().clear(account);