1package eu.siacs.conversations.parser;
2
3import android.util.Log;
4import android.util.Pair;
5
6import eu.siacs.conversations.crypto.PgpDecryptionService;
7import net.java.otr4j.session.Session;
8import net.java.otr4j.session.SessionStatus;
9
10import java.util.ArrayList;
11import java.util.Set;
12
13import eu.siacs.conversations.Config;
14import eu.siacs.conversations.crypto.axolotl.AxolotlService;
15import eu.siacs.conversations.crypto.axolotl.XmppAxolotlMessage;
16import eu.siacs.conversations.entities.Account;
17import eu.siacs.conversations.entities.Bookmark;
18import eu.siacs.conversations.entities.Contact;
19import eu.siacs.conversations.entities.Conversation;
20import eu.siacs.conversations.entities.Message;
21import eu.siacs.conversations.entities.MucOptions;
22import eu.siacs.conversations.http.HttpConnectionManager;
23import eu.siacs.conversations.services.MessageArchiveService;
24import eu.siacs.conversations.services.XmppConnectionService;
25import eu.siacs.conversations.utils.CryptoHelper;
26import eu.siacs.conversations.xml.Element;
27import eu.siacs.conversations.xmpp.OnMessagePacketReceived;
28import eu.siacs.conversations.xmpp.chatstate.ChatState;
29import eu.siacs.conversations.xmpp.jid.Jid;
30import eu.siacs.conversations.xmpp.pep.Avatar;
31import eu.siacs.conversations.xmpp.stanzas.MessagePacket;
32
33public class MessageParser extends AbstractParser implements
34 OnMessagePacketReceived {
35 public MessageParser(XmppConnectionService service) {
36 super(service);
37 }
38
39 private boolean extractChatState(Conversation conversation, final MessagePacket packet) {
40 ChatState state = ChatState.parse(packet);
41 if (state != null && conversation != null) {
42 final Account account = conversation.getAccount();
43 Jid from = packet.getFrom();
44 if (from.toBareJid().equals(account.getJid().toBareJid())) {
45 conversation.setOutgoingChatState(state);
46 if (state == ChatState.ACTIVE || state == ChatState.COMPOSING) {
47 mXmppConnectionService.markRead(conversation);
48 account.activateGracePeriod();
49 }
50 return false;
51 } else {
52 return conversation.setIncomingChatState(state);
53 }
54 }
55 return false;
56 }
57
58 private Message parseOtrChat(String body, Jid from, String id, Conversation conversation) {
59 String presence;
60 if (from.isBareJid()) {
61 presence = "";
62 } else {
63 presence = from.getResourcepart();
64 }
65 if (body.matches("^\\?OTRv\\d{1,2}\\?.*")) {
66 conversation.endOtrIfNeeded();
67 }
68 if (!conversation.hasValidOtrSession()) {
69 conversation.startOtrSession(presence,false);
70 } else {
71 String foreignPresence = conversation.getOtrSession().getSessionID().getUserID();
72 if (!foreignPresence.equals(presence)) {
73 conversation.endOtrIfNeeded();
74 conversation.startOtrSession(presence, false);
75 }
76 }
77 try {
78 conversation.setLastReceivedOtrMessageId(id);
79 Session otrSession = conversation.getOtrSession();
80 body = otrSession.transformReceiving(body);
81 SessionStatus status = otrSession.getSessionStatus();
82 if (body == null && status == SessionStatus.ENCRYPTED) {
83 mXmppConnectionService.onOtrSessionEstablished(conversation);
84 return null;
85 } else if (body == null && status == SessionStatus.FINISHED) {
86 conversation.resetOtrSession();
87 mXmppConnectionService.updateConversationUi();
88 return null;
89 } else if (body == null || (body.isEmpty())) {
90 return null;
91 }
92 if (body.startsWith(CryptoHelper.FILETRANSFER)) {
93 String key = body.substring(CryptoHelper.FILETRANSFER.length());
94 conversation.setSymmetricKey(CryptoHelper.hexToBytes(key));
95 return null;
96 }
97 Message finishedMessage = new Message(conversation, body, Message.ENCRYPTION_OTR, Message.STATUS_RECEIVED);
98 conversation.setLastReceivedOtrMessageId(null);
99 return finishedMessage;
100 } catch (Exception e) {
101 conversation.resetOtrSession();
102 return null;
103 }
104 }
105
106 private Message parseAxolotlChat(Element axolotlMessage, Jid from, String id, Conversation conversation, int status) {
107 Message finishedMessage = null;
108 AxolotlService service = conversation.getAccount().getAxolotlService();
109 XmppAxolotlMessage xmppAxolotlMessage = XmppAxolotlMessage.fromElement(axolotlMessage, from.toBareJid());
110 XmppAxolotlMessage.XmppAxolotlPlaintextMessage plaintextMessage = service.processReceivingPayloadMessage(xmppAxolotlMessage);
111 if(plaintextMessage != null) {
112 finishedMessage = new Message(conversation, plaintextMessage.getPlaintext(), Message.ENCRYPTION_AXOLOTL, status);
113 finishedMessage.setAxolotlFingerprint(plaintextMessage.getFingerprint());
114 Log.d(Config.LOGTAG, AxolotlService.getLogprefix(finishedMessage.getConversation().getAccount())+" Received Message with session fingerprint: "+plaintextMessage.getFingerprint());
115 }
116
117 return finishedMessage;
118 }
119
120 private class Invite {
121 Jid jid;
122 String password;
123 Invite(Jid jid, String password) {
124 this.jid = jid;
125 this.password = password;
126 }
127
128 public boolean execute(Account account) {
129 if (jid != null) {
130 Conversation conversation = mXmppConnectionService.findOrCreateConversation(account, jid, true);
131 if (!conversation.getMucOptions().online()) {
132 conversation.getMucOptions().setPassword(password);
133 mXmppConnectionService.databaseBackend.updateConversation(conversation);
134 mXmppConnectionService.joinMuc(conversation);
135 mXmppConnectionService.updateConversationUi();
136 }
137 return true;
138 }
139 return false;
140 }
141 }
142
143 private Invite extractInvite(Element message) {
144 Element x = message.findChild("x", "http://jabber.org/protocol/muc#user");
145 if (x != null) {
146 Element invite = x.findChild("invite");
147 if (invite != null) {
148 Element pw = x.findChild("password");
149 return new Invite(message.getAttributeAsJid("from"), pw != null ? pw.getContent(): null);
150 }
151 } else {
152 x = message.findChild("x","jabber:x:conference");
153 if (x != null) {
154 return new Invite(x.getAttributeAsJid("jid"),x.getAttribute("password"));
155 }
156 }
157 return null;
158 }
159
160 private static String extractStanzaId(Element packet, Jid by) {
161 for(Element child : packet.getChildren()) {
162 if (child.getName().equals("stanza-id")
163 && "urn:xmpp:sid:0".equals(child.getNamespace())
164 && by.equals(child.getAttributeAsJid("by"))) {
165 return child.getAttribute("id");
166 }
167 }
168 return null;
169 }
170
171 private void parseEvent(final Element event, final Jid from, final Account account) {
172 Element items = event.findChild("items");
173 String node = items == null ? null : items.getAttribute("node");
174 if ("urn:xmpp:avatar:metadata".equals(node)) {
175 Avatar avatar = Avatar.parseMetadata(items);
176 if (avatar != null) {
177 avatar.owner = from.toBareJid();
178 if (mXmppConnectionService.getFileBackend().isAvatarCached(avatar)) {
179 if (account.getJid().toBareJid().equals(from)) {
180 if (account.setAvatar(avatar.getFilename())) {
181 mXmppConnectionService.databaseBackend.updateAccount(account);
182 }
183 mXmppConnectionService.getAvatarService().clear(account);
184 mXmppConnectionService.updateConversationUi();
185 mXmppConnectionService.updateAccountUi();
186 } else {
187 Contact contact = account.getRoster().getContact(from);
188 contact.setAvatar(avatar);
189 mXmppConnectionService.getAvatarService().clear(contact);
190 mXmppConnectionService.updateConversationUi();
191 mXmppConnectionService.updateRosterUi();
192 }
193 } else {
194 mXmppConnectionService.fetchAvatar(account, avatar);
195 }
196 }
197 } else if ("http://jabber.org/protocol/nick".equals(node)) {
198 Element i = items.findChild("item");
199 Element nick = i == null ? null : i.findChild("nick", "http://jabber.org/protocol/nick");
200 if (nick != null && nick.getContent() != null) {
201 Contact contact = account.getRoster().getContact(from);
202 contact.setPresenceName(nick.getContent());
203 mXmppConnectionService.getAvatarService().clear(account);
204 mXmppConnectionService.updateConversationUi();
205 mXmppConnectionService.updateAccountUi();
206 }
207 } else if (AxolotlService.PEP_DEVICE_LIST.equals(node)) {
208 Log.d(Config.LOGTAG, AxolotlService.getLogprefix(account)+"Received PEP device list update from "+ from + ", processing...");
209 Element item = items.findChild("item");
210 Set<Integer> deviceIds = mXmppConnectionService.getIqParser().deviceIds(item);
211 AxolotlService axolotlService = account.getAxolotlService();
212 axolotlService.registerDevices(from, deviceIds);
213 mXmppConnectionService.updateAccountUi();
214 }
215 }
216
217 private boolean handleErrorMessage(Account account, MessagePacket packet) {
218 if (packet.getType() == MessagePacket.TYPE_ERROR) {
219 Jid from = packet.getFrom();
220 if (from != null) {
221 Element error = packet.findChild("error");
222 String text = error == null ? null : error.findChildContent("text");
223 if (text != null) {
224 Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": sending message to "+ from+ " failed - " + text);
225 } else if (error != null) {
226 Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": sending message to "+ from+ " failed - " + error);
227 }
228 Message message = mXmppConnectionService.markMessage(account,
229 from.toBareJid(),
230 packet.getId(),
231 Message.STATUS_SEND_FAILED);
232 if (message != null && message.getEncryption() == Message.ENCRYPTION_OTR) {
233 message.getConversation().endOtrIfNeeded();
234 }
235 }
236 return true;
237 }
238 return false;
239 }
240
241 @Override
242 public void onMessagePacketReceived(Account account, MessagePacket original) {
243 if (handleErrorMessage(account, original)) {
244 return;
245 }
246 final MessagePacket packet;
247 Long timestamp = null;
248 final boolean isForwarded;
249 boolean isCarbon = false;
250 String serverMsgId = null;
251 final Element fin = original.findChild("fin", "urn:xmpp:mam:0");
252 if (fin != null) {
253 mXmppConnectionService.getMessageArchiveService().processFin(fin,original.getFrom());
254 return;
255 }
256 final Element result = original.findChild("result","urn:xmpp:mam:0");
257 final MessageArchiveService.Query query = result == null ? null : mXmppConnectionService.getMessageArchiveService().findQuery(result.getAttribute("queryid"));
258 if (query != null && query.validFrom(original.getFrom())) {
259 Pair<MessagePacket, Long> f = original.getForwardedMessagePacket("result", "urn:xmpp:mam:0");
260 if (f == null) {
261 return;
262 }
263 timestamp = f.second;
264 packet = f.first;
265 isForwarded = true;
266 serverMsgId = result.getAttribute("id");
267 query.incrementMessageCount();
268 } else if (query != null) {
269 Log.d(Config.LOGTAG,account.getJid().toBareJid()+": received mam result from invalid sender");
270 return;
271 } else if (original.fromServer(account)) {
272 Pair<MessagePacket, Long> f;
273 f = original.getForwardedMessagePacket("received", "urn:xmpp:carbons:2");
274 f = f == null ? original.getForwardedMessagePacket("sent", "urn:xmpp:carbons:2") : f;
275 packet = f != null ? f.first : original;
276 if (handleErrorMessage(account, packet)) {
277 return;
278 }
279 timestamp = f != null ? f.second : null;
280 isCarbon = f != null;
281 isForwarded = isCarbon;
282 } else {
283 packet = original;
284 isForwarded = false;
285 }
286
287 if (timestamp == null) {
288 timestamp = AbstractParser.getTimestamp(packet, System.currentTimeMillis());
289 }
290 final String body = packet.getBody();
291 final Element mucUserElement = packet.findChild("x", "http://jabber.org/protocol/muc#user");
292 final String pgpEncrypted = packet.findChildContent("x", "jabber:x:encrypted");
293 final Element replaceElement = packet.findChild("replace","urn:xmpp:message-correct:0");
294 final String replacementId = replaceElement == null ? null : replaceElement.getAttribute("id");
295 final Element axolotlEncrypted = packet.findChild(XmppAxolotlMessage.CONTAINERTAG, AxolotlService.PEP_PREFIX);
296 int status;
297 final Jid counterpart;
298 final Jid to = packet.getTo();
299 final Jid from = packet.getFrom();
300 final String remoteMsgId = packet.getId();
301
302 if (from == null) {
303 Log.d(Config.LOGTAG,"no from in: "+packet.toString());
304 return;
305 }
306
307 boolean isTypeGroupChat = packet.getType() == MessagePacket.TYPE_GROUPCHAT;
308 boolean isProperlyAddressed = (to != null ) && (!to.isBareJid() || account.countPresences() <= 1);
309 boolean isMucStatusMessage = from.isBareJid() && mucUserElement != null && mucUserElement.hasChild("status");
310 if (packet.fromAccount(account)) {
311 status = Message.STATUS_SEND;
312 counterpart = to != null ? to : account.getJid();
313 } else {
314 status = Message.STATUS_RECEIVED;
315 counterpart = from;
316 }
317
318 Invite invite = extractInvite(packet);
319 if (invite != null && invite.execute(account)) {
320 return;
321 }
322
323 if (extractChatState(mXmppConnectionService.find(account, counterpart.toBareJid()), packet)) {
324 mXmppConnectionService.updateConversationUi();
325 }
326
327 if ((body != null || pgpEncrypted != null || axolotlEncrypted != null) && !isMucStatusMessage) {
328 Conversation conversation = mXmppConnectionService.findOrCreateConversation(account, counterpart.toBareJid(), isTypeGroupChat, query);
329 if (isTypeGroupChat) {
330 if (counterpart.getResourcepart().equals(conversation.getMucOptions().getActualNick())) {
331 status = Message.STATUS_SEND_RECEIVED;
332 isCarbon = true; //not really carbon but received from another resource
333 if (mXmppConnectionService.markMessage(conversation, remoteMsgId, status)) {
334 return;
335 } else if (remoteMsgId == null || Config.IGNORE_ID_REWRITE_IN_MUC) {
336 Message message = conversation.findSentMessageWithBody(packet.getBody());
337 if (message != null) {
338 mXmppConnectionService.markMessage(message, status);
339 return;
340 }
341 }
342 } else {
343 status = Message.STATUS_RECEIVED;
344 }
345 }
346 Message message;
347 if (body != null && body.startsWith("?OTR")) {
348 if (!isForwarded && !isTypeGroupChat && isProperlyAddressed) {
349 message = parseOtrChat(body, from, remoteMsgId, conversation);
350 if (message == null) {
351 return;
352 }
353 } else {
354 Log.d(Config.LOGTAG,account.getJid().toBareJid()+": ignoring OTR message from "+from+" isForwarded="+Boolean.toString(isForwarded)+", isProperlyAddressed="+Boolean.valueOf(isProperlyAddressed));
355 message = new Message(conversation, body, Message.ENCRYPTION_NONE, status);
356 }
357 } else if (pgpEncrypted != null) {
358 message = new Message(conversation, pgpEncrypted, Message.ENCRYPTION_PGP, status);
359 } else if (axolotlEncrypted != null) {
360 message = parseAxolotlChat(axolotlEncrypted, from, remoteMsgId, conversation, status);
361 if (message == null) {
362 return;
363 }
364 } else {
365 message = new Message(conversation, body, Message.ENCRYPTION_NONE, status);
366 }
367
368 if (serverMsgId == null) {
369 serverMsgId = extractStanzaId(packet, isTypeGroupChat ? conversation.getJid().toBareJid() : account.getServer());
370 }
371
372 message.setCounterpart(counterpart);
373 message.setRemoteMsgId(remoteMsgId);
374 message.setServerMsgId(serverMsgId);
375 message.setCarbon(isCarbon);
376 message.setTime(timestamp);
377 message.markable = packet.hasChild("markable", "urn:xmpp:chat-markers:0");
378 if (conversation.getMode() == Conversation.MODE_MULTI) {
379 Jid trueCounterpart = conversation.getMucOptions().getTrueCounterpart(counterpart.getResourcepart());
380 message.setTrueCounterpart(trueCounterpart);
381 if (trueCounterpart != null) {
382 updateLastseen(timestamp, account, trueCounterpart, false);
383 }
384 if (!isTypeGroupChat) {
385 message.setType(Message.TYPE_PRIVATE);
386 }
387 } else {
388 updateLastseen(timestamp, account, packet.getFrom(), true);
389 }
390
391 if (replacementId != null && mXmppConnectionService.allowMessageCorrection()) {
392 Message replacedMessage = conversation.findMessageWithRemoteIdAndCounterpart(replacementId,
393 counterpart,
394 message.getStatus() == Message.STATUS_RECEIVED,
395 message.isCarbon());
396 if (replacedMessage != null) {
397 final boolean fingerprintsMatch = replacedMessage.getAxolotlFingerprint() == null
398 || replacedMessage.getAxolotlFingerprint().equals(message.getAxolotlFingerprint());
399 final boolean trueCountersMatch = replacedMessage.getTrueCounterpart() != null
400 && replacedMessage.getTrueCounterpart().equals(message.getTrueCounterpart());
401 if (fingerprintsMatch && (trueCountersMatch || conversation.getMode() == Conversation.MODE_SINGLE)) {
402 Log.d(Config.LOGTAG, "replaced message '" + replacedMessage.getBody() + "' with '" + message.getBody() + "'");
403 replacedMessage.setBody(message.getBody());
404 replacedMessage.setEdited(replacedMessage.getRemoteMsgId());
405 replacedMessage.setRemoteMsgId(remoteMsgId);
406 replacedMessage.setEncryption(message.getEncryption());
407 if (replacedMessage.getStatus() == Message.STATUS_RECEIVED) {
408 replacedMessage.markUnread();
409 }
410 mXmppConnectionService.updateMessage(replacedMessage);
411 if (mXmppConnectionService.confirmMessages() && remoteMsgId != null && !isForwarded && !isTypeGroupChat) {
412 sendMessageReceipts(account, packet);
413 }
414 if (replacedMessage.getEncryption() == Message.ENCRYPTION_PGP) {
415 conversation.getAccount().getPgpDecryptionService().add(replacedMessage);
416 }
417 return;
418 } else {
419 Log.d(Config.LOGTAG,account.getJid().toBareJid()+": received message correction but verification didn't check out");
420 }
421 }
422 }
423
424 boolean checkForDuplicates = query != null
425 || (isTypeGroupChat && packet.hasChild("delay","urn:xmpp:delay"))
426 || message.getType() == Message.TYPE_PRIVATE;
427 if (checkForDuplicates && conversation.hasDuplicateMessage(message)) {
428 Log.d(Config.LOGTAG,"skipping duplicate message from "+message.getCounterpart().toString()+" "+message.getBody());
429 return;
430 }
431
432 if (query != null && query.getPagingOrder() == MessageArchiveService.PagingOrder.REVERSE) {
433 conversation.prepend(message);
434 } else {
435 conversation.add(message);
436 }
437
438 if (message.getEncryption() == Message.ENCRYPTION_PGP) {
439 conversation.getAccount().getPgpDecryptionService().add(message);
440 }
441
442 if (query == null || query.getWith() == null) { //either no mam or catchup
443 if (status == Message.STATUS_SEND || status == Message.STATUS_SEND_RECEIVED) {
444 mXmppConnectionService.markRead(conversation);
445 if (query == null) {
446 account.activateGracePeriod();
447 }
448 } else {
449 message.markUnread();
450 }
451 }
452
453 if (query == null) {
454 mXmppConnectionService.updateConversationUi();
455 }
456
457 if (mXmppConnectionService.confirmMessages() && remoteMsgId != null && !isForwarded && !isTypeGroupChat) {
458 sendMessageReceipts(account, packet);
459 }
460
461 if (message.getStatus() == Message.STATUS_RECEIVED
462 && conversation.getOtrSession() != null
463 && !conversation.getOtrSession().getSessionID().getUserID()
464 .equals(message.getCounterpart().getResourcepart())) {
465 conversation.endOtrIfNeeded();
466 }
467
468 if (message.getEncryption() == Message.ENCRYPTION_NONE || mXmppConnectionService.saveEncryptedMessages()) {
469 mXmppConnectionService.databaseBackend.createMessage(message);
470 }
471 final HttpConnectionManager manager = this.mXmppConnectionService.getHttpConnectionManager();
472 if (message.trusted() && message.treatAsDownloadable() != Message.Decision.NEVER && manager.getAutoAcceptFileSize() > 0) {
473 manager.createNewDownloadConnection(message);
474 } else if (!message.isRead()) {
475 if (query == null) {
476 mXmppConnectionService.getNotificationService().push(message);
477 } else if (query.getWith() == null) { // mam catchup
478 mXmppConnectionService.getNotificationService().pushFromBacklog(message);
479 }
480 }
481 } else if (!packet.hasChild("body")){ //no body
482 if (isTypeGroupChat) {
483 Conversation conversation = mXmppConnectionService.find(account, from.toBareJid());
484 if (packet.hasChild("subject")) {
485 if (conversation != null && conversation.getMode() == Conversation.MODE_MULTI) {
486 conversation.setHasMessagesLeftOnServer(conversation.countMessages() > 0);
487 String subject = packet.findChildContent("subject");
488 conversation.getMucOptions().setSubject(subject);
489 final Bookmark bookmark = conversation.getBookmark();
490 if (bookmark != null && bookmark.getBookmarkName() == null) {
491 if (bookmark.setBookmarkName(subject)) {
492 mXmppConnectionService.pushBookmarks(account);
493 }
494 }
495 mXmppConnectionService.updateConversationUi();
496 return;
497 }
498 }
499
500 if (conversation != null && isMucStatusMessage) {
501 for (Element child : mucUserElement.getChildren()) {
502 if (child.getName().equals("status")
503 && MucOptions.STATUS_CODE_ROOM_CONFIG_CHANGED.equals(child.getAttribute("code"))) {
504 mXmppConnectionService.fetchConferenceConfiguration(conversation);
505 }
506 }
507 }
508 }
509 }
510
511 Element received = packet.findChild("received", "urn:xmpp:chat-markers:0");
512 if (received == null) {
513 received = packet.findChild("received", "urn:xmpp:receipts");
514 }
515 if (received != null && !packet.fromAccount(account)) {
516 mXmppConnectionService.markMessage(account, from.toBareJid(), received.getAttribute("id"), Message.STATUS_SEND_RECEIVED);
517 }
518 Element displayed = packet.findChild("displayed", "urn:xmpp:chat-markers:0");
519 if (displayed != null) {
520 if (packet.fromAccount(account)) {
521 Conversation conversation = mXmppConnectionService.find(account,counterpart.toBareJid());
522 if (conversation != null) {
523 mXmppConnectionService.markRead(conversation);
524 }
525 } else {
526 updateLastseen(timestamp, account, packet.getFrom(), true);
527 final Message displayedMessage = mXmppConnectionService.markMessage(account, from.toBareJid(), displayed.getAttribute("id"), Message.STATUS_SEND_DISPLAYED);
528 Message message = displayedMessage == null ? null : displayedMessage.prev();
529 while (message != null
530 && message.getStatus() == Message.STATUS_SEND_RECEIVED
531 && message.getTimeSent() < displayedMessage.getTimeSent()) {
532 mXmppConnectionService.markMessage(message, Message.STATUS_SEND_DISPLAYED);
533 message = message.prev();
534 }
535 }
536 }
537
538 Element event = packet.findChild("event", "http://jabber.org/protocol/pubsub#event");
539 if (event != null) {
540 parseEvent(event, from, account);
541 }
542
543 String nick = packet.findChildContent("nick", "http://jabber.org/protocol/nick");
544 if (nick != null) {
545 Contact contact = account.getRoster().getContact(from);
546 contact.setPresenceName(nick);
547 }
548 }
549
550 private void sendMessageReceipts(Account account, MessagePacket packet) {
551 ArrayList<String> receiptsNamespaces = new ArrayList<>();
552 if (packet.hasChild("markable", "urn:xmpp:chat-markers:0")) {
553 receiptsNamespaces.add("urn:xmpp:chat-markers:0");
554 }
555 if (packet.hasChild("request", "urn:xmpp:receipts")) {
556 receiptsNamespaces.add("urn:xmpp:receipts");
557 }
558 if (receiptsNamespaces.size() > 0) {
559 MessagePacket receipt = mXmppConnectionService.getMessageGenerator().received(account,
560 packet,
561 receiptsNamespaces,
562 packet.getType());
563 mXmppConnectionService.sendMessagePacket(account, receipt);
564 }
565 }
566}