@@ -57,8 +57,6 @@ public class UFEDChatParser extends AbstractParser {
57
57
58
58
public static final MediaType UFED_CHAT_PREVIEW_MIME = MediaType .application ("x-ufed-chat-preview" );
59
59
60
- public static final String UFED_CHILDREN_ATTR = "ufedChildren" ;
61
-
62
60
public static final String UFED_REPLIED_MESSAGE_ATTR = "ufedOriginalMessage" ;
63
61
64
62
public static final Map <String , MediaType > appToMime = ImmutableMap .of ( //
@@ -154,9 +152,11 @@ public void parse(InputStream inputStream, ContentHandler handler, Metadata meta
154
152
if (chat == null || searcher == null )
155
153
return ;
156
154
157
- List < Message > messages = new ArrayList <>( );
158
- List < IItemReader > chatChildren = ( List < IItemReader >) chat . getExtraAttributeMap (). remove ( UFED_CHILDREN_ATTR );
155
+ updateChatMetadata ( chatMeta , searcher );
156
+ Chat chat = createChat ( chatItem , searcher );
159
157
158
+ List <Message > messages = new ArrayList <>();
159
+ List <IItemReader > chatChildren = chatItem .getChildren ();
160
160
if (chatChildren != null ) {
161
161
for (IItemReader chatChild : chatChildren ) {
162
162
@@ -177,6 +177,7 @@ public void parse(InputStream inputStream, ContentHandler handler, Metadata meta
177
177
if (messagesCount == 0 && ignoreEmptyChats ) {
178
178
return ;
179
179
}
180
+ chatMeta .set (ExtraProperties .CONVERSATION_MESSAGES_COUNT , messagesCount );
180
181
181
182
Collections .sort (messages );
182
183
@@ -340,6 +341,7 @@ private IItemReader lookupAccount(IItemSearcher searcher, Metadata chatMetadata)
340
341
341
342
private void fillAccountInfo (IItemSearcher searcher , Metadata chatMetadata ) {
342
343
String name , id , phone = null , username = null ;
344
+ String source = readUfedMetadata (chatMetadata , "Source" );
343
345
IItemReader account = lookupAccount (searcher , chatMetadata );
344
346
if (account != null ) {
345
347
name = readUfedMetadata (account , "name" );
@@ -396,6 +398,7 @@ private IItemReader lookupParticipant(IItemSearcher searcher, Metadata chatMetad
396
398
397
399
private void fillParticipantInfo (IItemSearcher searcher , Metadata chatMetadata , Metadata targetMetadata ,
398
400
String ufedProperty , String conversationProperty ) {
401
+ String source = readUfedMetadata (chatMetadata , "Source" );
399
402
List <String > partyIDs = readUfedMetadataArray (targetMetadata , ufedProperty + ":ID" );
400
403
List <String > partyNames = readUfedMetadataArray (targetMetadata , ufedProperty + ":Name" );
401
404
for (int i = 0 ; i < partyIDs .size (); i ++) {
@@ -524,8 +527,7 @@ private Message createMessage(IItemReader messageItem, IItemSearcher searcher) {
524
527
Message message = new Message (messageItem );
525
528
handleMessagePosition (message , searcher );
526
529
527
- List <IItemReader > msgChildren = (List <IItemReader >) messageItem .getExtraAttributeMap ()
528
- .remove (UFED_CHILDREN_ATTR );
530
+ List <IItemReader > msgChildren = messageItem .getChildren ();
529
531
if (msgChildren != null ) {
530
532
for (IItemReader msgChild : msgChildren ) {
531
533
if (msgChild .getMediaType ().equals (MediaTypes .UFED_CHATACTIVITY_MIME )) {
0 commit comments