Skip to content

Commit

Permalink
'#2011: change Telegram group messages to use the group as TO field
Browse files Browse the repository at this point in the history
  • Loading branch information
lfcnassif committed Jul 26, 2024
1 parent 2143dee commit 56ac676
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,10 @@ private void extractMessages(String chatName, List<Message> messages, Contact ac
meta.set(org.apache.tika.metadata.Message.MESSAGE_FROM, m.getFrom().toString());
if (m.getChat().isGroupOrChannel()) {
ChatGroup groupChat = (ChatGroup) m.getChat();
for (Long id : groupChat.getMembers()) {
if (id != m.getFrom().getId())
meta.add(org.apache.tika.metadata.Message.MESSAGE_TO, e.getContact(id).toString());
}
String to = groupChat.isGroup() ? "Group " : "Channel ";
to += groupChat.getName() + " (id:" + groupChat.getId() + ")";
meta.add(org.apache.tika.metadata.Message.MESSAGE_TO, to);
meta.set(ExtraProperties.IS_GROUP_MESSAGE, "true");
}
if (meta.get(org.apache.tika.metadata.Message.MESSAGE_TO) == null) {
if (m.getToId() != 0) {
Expand Down

0 comments on commit 56ac676

Please sign in to comment.