Merge branch 'development' of https://github.com/siacs/Conversations into development
This commit is contained in:
		
						commit
						116456691d
					
				
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 702 B | 
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 479 B | 
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 900 B | 
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 1.1 KiB | 
|  | @ -286,5 +286,6 @@ public class Contact { | ||||||
| 		public static final int ASKING = 2; | 		public static final int ASKING = 2; | ||||||
| 		public static final int PREEMPTIVE_GRANT = 4; | 		public static final int PREEMPTIVE_GRANT = 4; | ||||||
| 		public static final int IN_ROSTER = 8; | 		public static final int IN_ROSTER = 8; | ||||||
|  | 		public static final int PENDING_SUBSCRIPTION_REQUEST = 16; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -303,12 +303,6 @@ public class XmppConnectionService extends Service { | ||||||
| 				} else { | 				} else { | ||||||
| 					Contact contact = account.getRoster().getContact( | 					Contact contact = account.getRoster().getContact( | ||||||
| 							packet.getFrom()); | 							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 (type == null) { | ||||||
| 						if (fromParts.length == 2) { | 						if (fromParts.length == 2) { | ||||||
| 							contact.updatePresence(fromParts[1], Presences | 							contact.updatePresence(fromParts[1], Presences | ||||||
|  | @ -327,12 +321,6 @@ public class XmppConnectionService extends Service { | ||||||
| 									} | 									} | ||||||
| 									contact.setPgpKeyId(pgp.fetchKeyId(account, | 									contact.setPgpKeyId(pgp.fetchKeyId(account, | ||||||
| 											msg, x.getContent())); | 											msg, x.getContent())); | ||||||
| 									Log.d("xmppService", |  | ||||||
| 											account.getJid() |  | ||||||
| 													+ ": fetched key id for " |  | ||||||
| 													+ contact.getJid() |  | ||||||
| 													+ " was:" |  | ||||||
| 													+ contact.getPgpKeyId()); |  | ||||||
| 								} | 								} | ||||||
| 							} | 							} | ||||||
| 						} else { | 						} else { | ||||||
|  | @ -357,8 +345,7 @@ public class XmppConnectionService extends Service { | ||||||
| 								requestPresenceUpdatesFrom(contact); | 								requestPresenceUpdatesFrom(contact); | ||||||
| 							} | 							} | ||||||
| 						} else { | 						} else { | ||||||
| 							account.getXmppConnection().addPendingSubscription( | 							contact.setOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST); | ||||||
| 									fromParts[0]); |  | ||||||
| 						} | 						} | ||||||
| 					} else { | 					} else { | ||||||
| 						// Log.d(LOGTAG, packet.toString()); | 						// Log.d(LOGTAG, packet.toString()); | ||||||
|  | @ -1198,8 +1185,7 @@ public class XmppConnectionService extends Service { | ||||||
| 		pushContactToServer(contact); | 		pushContactToServer(contact); | ||||||
| 		if (autoGrant) { | 		if (autoGrant) { | ||||||
| 			requestPresenceUpdatesFrom(contact); | 			requestPresenceUpdatesFrom(contact); | ||||||
| 			if (contact.getAccount().getXmppConnection().hasPendingSubscription( | 			if (contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) { | ||||||
| 					contact.getJid())) { |  | ||||||
| 				Log.d("xmppService", "contact had pending subscription"); | 				Log.d("xmppService", "contact had pending subscription"); | ||||||
| 				sendPresenceUpdatesTo(contact); | 				sendPresenceUpdatesTo(contact); | ||||||
| 			} | 			} | ||||||
|  | @ -1260,6 +1246,7 @@ public class XmppConnectionService extends Service { | ||||||
| 		packet.setAttribute("from", contact.getAccount().getJid()); | 		packet.setAttribute("from", contact.getAccount().getJid()); | ||||||
| 		Log.d(LOGTAG, packet.toString()); | 		Log.d(LOGTAG, packet.toString()); | ||||||
| 		contact.getAccount().getXmppConnection().sendPresencePacket(packet); | 		contact.getAccount().getXmppConnection().sendPresencePacket(packet); | ||||||
|  | 		contact.resetOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public void sendPresence(Account account) { | 	public void sendPresence(Account account) { | ||||||
|  |  | ||||||
|  | @ -392,20 +392,17 @@ public class ConversationFragment extends Fragment { | ||||||
| 
 | 
 | ||||||
| 				if (type == RECIEVED) { | 				if (type == RECIEVED) { | ||||||
| 					if (item.getConversation().getMode() == Conversation.MODE_MULTI) { | 					if (item.getConversation().getMode() == Conversation.MODE_MULTI) { | ||||||
| 						if (item.getCounterpart() != null) { | 						viewHolder.contact_picture.setImageBitmap(mBitmapCache | ||||||
| 							viewHolder.contact_picture | 								.get(item.getCounterpart(), null, getActivity() | ||||||
| 									.setImageBitmap(mBitmapCache.get(item | 										.getApplicationContext())); | ||||||
| 											.getCounterpart(), null, | 						viewHolder.contact_picture | ||||||
| 											getActivity() | 								.setOnClickListener(new OnClickListener() { | ||||||
| 													.getApplicationContext())); | 
 | ||||||
| 						} else { | 									@Override | ||||||
| 							viewHolder.contact_picture | 									public void onClick(View v) { | ||||||
| 									.setImageBitmap(mBitmapCache.get( | 										highlightInConference(item.getCounterpart()); | ||||||
| 											item.getConversation().getName( | 									} | ||||||
| 													useSubject), null, | 								}); | ||||||
| 											getActivity() |  | ||||||
| 													.getApplicationContext())); |  | ||||||
| 						} |  | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
|  | @ -461,6 +458,22 @@ public class ConversationFragment extends Fragment { | ||||||
| 		return view; | 		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() { | 	protected Bitmap findSelfPicture() { | ||||||
| 		SharedPreferences sharedPref = PreferenceManager | 		SharedPreferences sharedPref = PreferenceManager | ||||||
| 				.getDefaultSharedPreferences(getActivity() | 				.getDefaultSharedPreferences(getActivity() | ||||||
|  |  | ||||||
|  | @ -74,9 +74,7 @@ public class XmppConnection implements Runnable { | ||||||
| 	private boolean shouldAuthenticate = true; | 	private boolean shouldAuthenticate = true; | ||||||
| 	private Element streamFeatures; | 	private Element streamFeatures; | ||||||
| 	private HashMap<String, List<String>> disco = new HashMap<String, List<String>>(); | 	private HashMap<String, List<String>> disco = new HashMap<String, List<String>>(); | ||||||
| 	 | 
 | ||||||
| 	private HashSet<String> pendingSubscriptions = new HashSet<String>(); |  | ||||||
| 	 |  | ||||||
| 	private String streamId = null; | 	private String streamId = null; | ||||||
| 	private int smVersion = 3; | 	private int smVersion = 3; | ||||||
| 	 | 	 | ||||||
|  | @ -261,6 +259,7 @@ public class XmppConnection implements Runnable { | ||||||
| 				RequestPacket r = new RequestPacket(smVersion); | 				RequestPacket r = new RequestPacket(smVersion); | ||||||
| 				tagWriter.writeStanzaAsync(r); | 				tagWriter.writeStanzaAsync(r); | ||||||
| 			} else if (nextTag.isStart("resumed")) { | 			} else if (nextTag.isStart("resumed")) { | ||||||
|  | 				lastPaketReceived = SystemClock.elapsedRealtime(); | ||||||
| 				Log.d(LOGTAG,account.getJid()+": session resumed"); | 				Log.d(LOGTAG,account.getJid()+": session resumed"); | ||||||
| 				tagReader.readElement(nextTag); | 				tagReader.readElement(nextTag); | ||||||
| 				sendPing(); | 				sendPing(); | ||||||
|  | @ -904,15 +903,6 @@ public class XmppConnection implements Runnable { | ||||||
| 		return findDiscoItemByFeature("http://jabber.org/protocol/muc"); | 		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() { | 	public int getTimeToNextAttempt() { | ||||||
| 		int interval = (int) (25 * Math.pow(1.5,attempt)); | 		int interval = (int) (25 * Math.pow(1.5,attempt)); | ||||||
| 		int secondsSinceLast = (int) ((SystemClock.elapsedRealtime() - this.lastConnect) / 1000); | 		int secondsSinceLast = (int) ((SystemClock.elapsedRealtime() - this.lastConnect) / 1000); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 kruks23
						kruks23