aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/eu/siacs/conversations/services/XmppConnectionService.java')
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index cf3f72dc..4ab2d42b 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -389,7 +389,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
final String action = intent == null ? null : intent.getAction();
if (action != null) {
if (action.equals(ACTION_MERGE_PHONE_CONTACTS)) {
- PhoneHelper.loadPhoneContacts(getApplicationContext(), new ArrayList<Bundle>(), this);
+ PhoneHelper.loadPhoneContacts(getApplicationContext(), new CopyOnWriteArrayList<Bundle>(), this);
return START_STICKY;
} else if (action.equals(Intent.ACTION_SHUTDOWN)) {
logoutAndSave();
@@ -500,7 +500,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
this.databaseBackend.readRoster(account.getRoster());
}
initConversations();
- PhoneHelper.loadPhoneContacts(getApplicationContext(),new ArrayList<Bundle>(), this);
+ PhoneHelper.loadPhoneContacts(getApplicationContext(),new CopyOnWriteArrayList<Bundle>(), this);
getContentResolver().registerContentObserver(ContactsContract.Contacts.CONTENT_URI, true, contactObserver);
this.fileObserver.startWatching();
@@ -1005,6 +1005,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
} else {
conversation.setMode(Conversation.MODE_SINGLE);
}
+ conversation.setNextEncryption(-1);
conversation.addAll(0, databaseBackend.getMessages(conversation, Config.PAGE_SIZE));
this.databaseBackend.updateConversation(conversation);
} else {
@@ -1040,6 +1041,8 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
}
public void archiveConversation(Conversation conversation) {
+ conversation.setStatus(Conversation.STATUS_ARCHIVED);
+ conversation.setNextEncryption(-1);
synchronized (this.conversations) {
if (conversation.getMode() == Conversation.MODE_MULTI) {
if (conversation.getAccount().getStatus() == Account.State.ONLINE) {
@@ -1513,6 +1516,28 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
});
}
+ public void changeAffiliationInConference(final Conversation conference, Jid user, MucOptions.Affiliation affiliation, final OnAffiliationChanged callback) {
+ final Jid jid = user.toBareJid();
+ IqPacket request = this.mIqGenerator.changeAffiliation(conference, jid, affiliation.toString());
+ Log.d(Config.LOGTAG,request.toString());
+ sendIqPacket(conference.getAccount(),request,new OnIqPacketReceived() {
+ @Override
+ public void onIqPacketReceived(Account account, IqPacket packet) {
+ Log.d(Config.LOGTAG,packet.toString());
+ if (packet.getType() == IqPacket.TYPE.RESULT) {
+ callback.onAffiliationChangedSuccessful(jid);
+ } else {
+ callback.onAffiliationChangeFailed(jid,R.string.could_not_change_affiliation);
+ }
+ }
+ });
+ }
+
+ public interface OnAffiliationChanged {
+ public void onAffiliationChangedSuccessful(Jid jid);
+ public void onAffiliationChangeFailed(Jid jid, int resId);
+ }
+
public void disconnect(Account account, boolean force) {
if ((account.getStatus() == Account.State.ONLINE)
|| (account.getStatus() == Account.State.DISABLED)) {