diff options
author | kruks23 <scardenas@openmailbox.org> | 2014-05-20 17:49:54 +0200 |
---|---|---|
committer | kruks23 <scardenas@openmailbox.org> | 2014-05-20 17:49:54 +0200 |
commit | 116456691dcb5484aaa8c11fb4d788a58177ac53 (patch) | |
tree | fe4ebf66a69103211679f4d469b143e0e40d3fff | |
parent | a5a356a7a7312c64d6d6c81ee773a36fe556233d (diff) | |
parent | ff6e51356f2e76418ed71f19b7232c840a1b6bce (diff) |
Merge branch 'development' of https://github.com/siacs/Conversations into development
Diffstat (limited to '')
-rw-r--r-- | res/drawable-hdpi/ic_action_search.png | bin | 0 -> 702 bytes | |||
-rw-r--r-- | res/drawable-mdpi/ic_action_search.png | bin | 0 -> 479 bytes | |||
-rw-r--r-- | res/drawable-xhdpi/ic_action_search.png | bin | 0 -> 900 bytes | |||
-rw-r--r-- | res/drawable-xxhdpi/ic_action_search.png | bin | 0 -> 1153 bytes | |||
-rw-r--r-- | src/eu/siacs/conversations/entities/Contact.java | 1 | ||||
-rw-r--r-- | src/eu/siacs/conversations/services/XmppConnectionService.java | 19 | ||||
-rw-r--r-- | src/eu/siacs/conversations/ui/ConversationFragment.java | 41 | ||||
-rw-r--r-- | src/eu/siacs/conversations/xmpp/XmppConnection.java | 14 |
8 files changed, 33 insertions, 42 deletions
diff --git a/res/drawable-hdpi/ic_action_search.png b/res/drawable-hdpi/ic_action_search.png Binary files differnew file mode 100644 index 00000000..f594b4e4 --- /dev/null +++ b/res/drawable-hdpi/ic_action_search.png diff --git a/res/drawable-mdpi/ic_action_search.png b/res/drawable-mdpi/ic_action_search.png Binary files differnew file mode 100644 index 00000000..2e446ec0 --- /dev/null +++ b/res/drawable-mdpi/ic_action_search.png diff --git a/res/drawable-xhdpi/ic_action_search.png b/res/drawable-xhdpi/ic_action_search.png Binary files differnew file mode 100644 index 00000000..aad535e9 --- /dev/null +++ b/res/drawable-xhdpi/ic_action_search.png diff --git a/res/drawable-xxhdpi/ic_action_search.png b/res/drawable-xxhdpi/ic_action_search.png Binary files differnew file mode 100644 index 00000000..9c0ea3ca --- /dev/null +++ b/res/drawable-xxhdpi/ic_action_search.png diff --git a/src/eu/siacs/conversations/entities/Contact.java b/src/eu/siacs/conversations/entities/Contact.java index ff1459a5..22e2661b 100644 --- a/src/eu/siacs/conversations/entities/Contact.java +++ b/src/eu/siacs/conversations/entities/Contact.java @@ -286,5 +286,6 @@ public class Contact { public static final int ASKING = 2; public static final int PREEMPTIVE_GRANT = 4; public static final int IN_ROSTER = 8; + public static final int PENDING_SUBSCRIPTION_REQUEST = 16; } } diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index 35e5fb51..9ea7f2b1 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -303,12 +303,6 @@ public class XmppConnectionService extends Service { } else { Contact contact = account.getRoster().getContact( packet.getFrom()); - /* - * if (contact == null) { if ("subscribe".equals(type)) { - * account.getXmppConnection().addPendingSubscription( - * fromParts[0]); } else { // Log.d(LOGTAG,packet.getFrom()+ - * // " could not be found"); } return; } - */ if (type == null) { if (fromParts.length == 2) { contact.updatePresence(fromParts[1], Presences @@ -327,12 +321,6 @@ public class XmppConnectionService extends Service { } contact.setPgpKeyId(pgp.fetchKeyId(account, msg, x.getContent())); - Log.d("xmppService", - account.getJid() - + ": fetched key id for " - + contact.getJid() - + " was:" - + contact.getPgpKeyId()); } } } else { @@ -357,8 +345,7 @@ public class XmppConnectionService extends Service { requestPresenceUpdatesFrom(contact); } } else { - account.getXmppConnection().addPendingSubscription( - fromParts[0]); + contact.setOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST); } } else { // Log.d(LOGTAG, packet.toString()); @@ -1198,8 +1185,7 @@ public class XmppConnectionService extends Service { pushContactToServer(contact); if (autoGrant) { requestPresenceUpdatesFrom(contact); - if (contact.getAccount().getXmppConnection().hasPendingSubscription( - contact.getJid())) { + if (contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) { Log.d("xmppService", "contact had pending subscription"); sendPresenceUpdatesTo(contact); } @@ -1260,6 +1246,7 @@ public class XmppConnectionService extends Service { packet.setAttribute("from", contact.getAccount().getJid()); Log.d(LOGTAG, packet.toString()); contact.getAccount().getXmppConnection().sendPresencePacket(packet); + contact.resetOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST); } public void sendPresence(Account account) { diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java index b551e6ad..7ab01936 100644 --- a/src/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/eu/siacs/conversations/ui/ConversationFragment.java @@ -392,20 +392,17 @@ public class ConversationFragment extends Fragment { if (type == RECIEVED) { if (item.getConversation().getMode() == Conversation.MODE_MULTI) { - if (item.getCounterpart() != null) { - viewHolder.contact_picture - .setImageBitmap(mBitmapCache.get(item - .getCounterpart(), null, - getActivity() - .getApplicationContext())); - } else { - viewHolder.contact_picture - .setImageBitmap(mBitmapCache.get( - item.getConversation().getName( - useSubject), null, - getActivity() - .getApplicationContext())); - } + viewHolder.contact_picture.setImageBitmap(mBitmapCache + .get(item.getCounterpart(), null, getActivity() + .getApplicationContext())); + viewHolder.contact_picture + .setOnClickListener(new OnClickListener() { + + @Override + public void onClick(View v) { + highlightInConference(item.getCounterpart()); + } + }); } } @@ -461,6 +458,22 @@ public class ConversationFragment extends Fragment { return view; } + protected void highlightInConference(String nick) { + if (chatMsg.getText().toString().isEmpty()) { + chatMsg.setText(nick+": "); + } else { + String oldString = chatMsg.getText().toString(); + if (oldString.endsWith(" ")) { + chatMsg.setText(oldString+nick+" "); + } else { + chatMsg.setText(oldString+" "+nick+" "); + } + } + int position = chatMsg.length(); + Editable etext = chatMsg.getText(); + Selection.setSelection(etext, position); + } + protected Bitmap findSelfPicture() { SharedPreferences sharedPref = PreferenceManager .getDefaultSharedPreferences(getActivity() diff --git a/src/eu/siacs/conversations/xmpp/XmppConnection.java b/src/eu/siacs/conversations/xmpp/XmppConnection.java index 58e110d6..0ba9677a 100644 --- a/src/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/eu/siacs/conversations/xmpp/XmppConnection.java @@ -74,9 +74,7 @@ public class XmppConnection implements Runnable { private boolean shouldAuthenticate = true; private Element streamFeatures; private HashMap<String, List<String>> disco = new HashMap<String, List<String>>(); - - private HashSet<String> pendingSubscriptions = new HashSet<String>(); - + private String streamId = null; private int smVersion = 3; @@ -261,6 +259,7 @@ public class XmppConnection implements Runnable { RequestPacket r = new RequestPacket(smVersion); tagWriter.writeStanzaAsync(r); } else if (nextTag.isStart("resumed")) { + lastPaketReceived = SystemClock.elapsedRealtime(); Log.d(LOGTAG,account.getJid()+": session resumed"); tagReader.readElement(nextTag); sendPing(); @@ -904,15 +903,6 @@ public class XmppConnection implements Runnable { return findDiscoItemByFeature("http://jabber.org/protocol/muc"); } - public boolean hasPendingSubscription(String jid) { - return this.pendingSubscriptions.contains(jid); - } - - public void addPendingSubscription(String jid) { - Log.d(LOGTAG,"adding "+jid+" to pending subscriptions"); - this.pendingSubscriptions.add(jid); - } - public int getTimeToNextAttempt() { int interval = (int) (25 * Math.pow(1.5,attempt)); int secondsSinceLast = (int) ((SystemClock.elapsedRealtime() - this.lastConnect) / 1000); |