From 7dfe4ae0823238da216088f80de40b9ff6b1446d Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 13 Apr 2014 18:09:40 +0200 Subject: some code cleanup. added setting to auto accept files. socks5 connections are now threaded --- .../conversations/services/XmppConnectionService.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/eu/siacs/conversations/services') diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index 986087d25..63ab0897e 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -124,9 +124,7 @@ public class XmppConnectionService extends Service { MessagePacket packet) { Message message = null; boolean notify = true; - if(PreferenceManager - .getDefaultSharedPreferences(getApplicationContext()) - .getBoolean("notification_grace_period_after_carbon_received", true)){ + if(getPreferences().getBoolean("notification_grace_period_after_carbon_received", true)){ notify=(SystemClock.elapsedRealtime() - lastCarbonMessageReceived) > CARBON_GRACE_PERIOD; } @@ -625,8 +623,7 @@ public class XmppConnectionService extends Service { } public XmppConnection createConnection(Account account) { - SharedPreferences sharedPref = PreferenceManager - .getDefaultSharedPreferences(getApplicationContext()); + SharedPreferences sharedPref = getPreferences(); account.setResource(sharedPref.getString("resource", "mobile").toLowerCase(Locale.getDefault())); XmppConnection connection = new XmppConnection(account, this.pm); connection.setOnMessagePacketReceivedListener(this.messageListener); @@ -1204,8 +1201,7 @@ public class XmppConnectionService extends Service { } public void createContact(Contact contact) { - SharedPreferences sharedPref = PreferenceManager - .getDefaultSharedPreferences(getApplicationContext()); + SharedPreferences sharedPref = getPreferences(); boolean autoGrant = sharedPref.getBoolean("grant_new_contacts", true); if (autoGrant) { contact.setSubscriptionOption(Contact.Subscription.PREEMPTIVE_GRANT); @@ -1396,4 +1392,8 @@ public class XmppConnectionService extends Service { convChangedListener.onConversationListChanged(); } } + + public SharedPreferences getPreferences() { + return PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); + } } -- cgit v1.2.3