aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/services/XmppConnectionService.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/eu/siacs/conversations/services/XmppConnectionService.java')
-rw-r--r--src/eu/siacs/conversations/services/XmppConnectionService.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java
index 2c905fec..8bc1b389 100644
--- a/src/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/eu/siacs/conversations/services/XmppConnectionService.java
@@ -7,6 +7,7 @@ import java.util.Comparator;
import java.util.Date;
import java.util.Hashtable;
import java.util.List;
+import java.util.Locale;
import java.util.Random;
import org.openintents.openpgp.util.OpenPgpApi;
@@ -550,6 +551,9 @@ public class XmppConnectionService extends Service {
}
public XmppConnection createConnection(Account account) {
+ SharedPreferences sharedPref = PreferenceManager
+ .getDefaultSharedPreferences(getApplicationContext());
+ account.setResource(sharedPref.getString("resource", "mobile").toLowerCase(Locale.getDefault()));
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
XmppConnection connection = new XmppConnection(account, pm);
connection.setOnMessagePacketReceivedListener(this.messageListener);
@@ -588,7 +592,7 @@ public class XmppConnectionService extends Service {
return connection;
}
- public void sendMessage(Message message, String presence) {
+ synchronized public void sendMessage(Message message, String presence) {
Account account = message.getConversation().getAccount();
Conversation conv = message.getConversation();
boolean saveInDb = false;