Project

General

Profile

Bug #287 » msgConcat.patch

Nolan Darilek, 07/23/2010 05:00 PM

View differences:

default.properties Wed Jul 21 23:29:41 2010 +0200 → default.properties Fri Jul 23 10:03:06 2010 -0500
8 8
# project structure.
9 9

  
10 10
# Project target.
11
target=android-7
11
target=android-8
src/com/beem/project/beem/ui/Chat.java Wed Jul 21 23:29:41 2010 +0200 → src/com/beem/project/beem/ui/Chat.java Fri Jul 23 10:03:06 2010 -0500
385 385
	for (Message m : chatMessages) {
386 386
	    String name = remoteName;
387 387
	    String fromBareJid = StringUtils.parseBareAddress(m.getFrom());
388
	    String lastNewOriginator = "";
388 389
	    if (m.getType() == Message.MSG_TYPE_ERROR) {
389 390
		lastMessage = null;
390 391
		result.add(new MessageText(fromBareJid, name, m.getBody(), true, m.getTimestamp()));
......
395 396
		}
396 397

  
397 398
		if (m.getBody() != null) {
398
		    if (lastMessage == null || !fromBareJid.equals(lastMessage.getBareJid())) {
399
		    if (lastMessage == null || !fromBareJid.equals(lastNewOriginator)) {
400
			lastNewOriginator = fromBareJid;
399 401
			lastMessage = new MessageText(fromBareJid, name, m.getBody(), false, m.getTimestamp());
400
			result.add(lastMessage);
401 402
		    } else {
402
			lastMessage.setMessage(lastMessage.getMessage().concat("\n" + m.getBody()));
403
			lastMessage = new MessageText("", name, m.getBody(), false, m.getTimestamp());
404

  
403 405
		    }
406
		result.add(lastMessage);
404 407
		}
405 408
	    }
406 409
	}
......
534 537
			    MessageText lastMessage = null;
535 538
			    if (mListMessages.size() != 0)
536 539
				lastMessage = mListMessages.get(mListMessages.size() - 1);
540
				String lastNewOriginator = "";
537 541

  
538
			    if (lastMessage != null && lastMessage.getBareJid().equals(fromBareJid)) {
539
				lastMessage.setMessage(lastMessage.getMessage().concat("\n" + msg.getBody()));
540
				lastMessage.setTimestamp(msg.getTimestamp());
541
				mListMessages.set(mListMessages.size() - 1, lastMessage);
542
			    if (lastMessage != null && lastNewOriginator.equals(fromBareJid)) {
543
				mListMessages.add(new MessageText("", mContact.getName(), msg.getBody(), false, msg.getTimestamp()));
542 544
			    } else if (msg.getBody() != null)
545
				lastNewOriginator = fromBareJid;
543 546
				mListMessages.add(new MessageText(fromBareJid, mContact.getName(), msg.getBody(), false, msg.getTimestamp()));
544 547
			    mMessagesListAdapter.notifyDataSetChanged();
545 548
			}
    (1-1/1)