mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 02:20:39 +00:00
Added sticker field to json output. Also added hidden mac file to .gitignore (#418)
This commit is contained in:
parent
a643609ed2
commit
9bba7a85ab
3 changed files with 27 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -10,3 +10,4 @@ local.properties
|
||||||
.project
|
.project
|
||||||
.settings/
|
.settings/
|
||||||
out/
|
out/
|
||||||
|
.DS_Store
|
||||||
|
|
|
@ -19,6 +19,7 @@ class JsonDataMessage {
|
||||||
JsonQuote quote;
|
JsonQuote quote;
|
||||||
List<JsonMention> mentions;
|
List<JsonMention> mentions;
|
||||||
List<JsonAttachment> attachments;
|
List<JsonAttachment> attachments;
|
||||||
|
JsonSticker sticker;
|
||||||
JsonGroupInfo groupInfo;
|
JsonGroupInfo groupInfo;
|
||||||
|
|
||||||
JsonDataMessage(SignalServiceDataMessage dataMessage, Manager m) {
|
JsonDataMessage(SignalServiceDataMessage dataMessage, Manager m) {
|
||||||
|
@ -60,15 +61,19 @@ class JsonDataMessage {
|
||||||
} else {
|
} else {
|
||||||
this.attachments = List.of();
|
this.attachments = List.of();
|
||||||
}
|
}
|
||||||
|
if (dataMessage.getSticker().isPresent()) {
|
||||||
|
this.sticker = new JsonSticker(dataMessage.getSticker().get());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public JsonDataMessage(Signal.MessageReceived messageReceived) {
|
public JsonDataMessage(Signal.MessageReceived messageReceived) {
|
||||||
timestamp = messageReceived.getTimestamp();
|
timestamp = messageReceived.getTimestamp();
|
||||||
message = messageReceived.getMessage();
|
message = messageReceived.getMessage();
|
||||||
groupInfo = new JsonGroupInfo(messageReceived.getGroupId());
|
groupInfo = new JsonGroupInfo(messageReceived.getGroupId());
|
||||||
reaction = null; // TODO Replace these 3 with the proper commands
|
reaction = null; // TODO Replace these 4 with the proper commands
|
||||||
quote = null;
|
quote = null;
|
||||||
mentions = null;
|
mentions = null;
|
||||||
|
sticker = null;
|
||||||
attachments = messageReceived.getAttachments().stream().map(JsonAttachment::new).collect(Collectors.toList());
|
attachments = messageReceived.getAttachments().stream().map(JsonAttachment::new).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,9 +81,10 @@ class JsonDataMessage {
|
||||||
timestamp = messageReceived.getTimestamp();
|
timestamp = messageReceived.getTimestamp();
|
||||||
message = messageReceived.getMessage();
|
message = messageReceived.getMessage();
|
||||||
groupInfo = new JsonGroupInfo(messageReceived.getGroupId());
|
groupInfo = new JsonGroupInfo(messageReceived.getGroupId());
|
||||||
reaction = null; // TODO Replace these 3 with the proper commands
|
reaction = null; // TODO Replace these 4 with the proper commands
|
||||||
quote = null;
|
quote = null;
|
||||||
mentions = null;
|
mentions = null;
|
||||||
|
sticker = null;
|
||||||
attachments = messageReceived.getAttachments().stream().map(JsonAttachment::new).collect(Collectors.toList());
|
attachments = messageReceived.getAttachments().stream().map(JsonAttachment::new).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
18
src/main/java/org/asamk/signal/json/JsonSticker.java
Normal file
18
src/main/java/org/asamk/signal/json/JsonSticker.java
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
|
||||||
|
import org.whispersystems.util.Base64;
|
||||||
|
|
||||||
|
public class JsonSticker {
|
||||||
|
|
||||||
|
String packId;
|
||||||
|
String packKey;
|
||||||
|
int stickerId;
|
||||||
|
|
||||||
|
public JsonSticker(SignalServiceDataMessage.Sticker sticker) {
|
||||||
|
this.packId = Base64.encodeBytes(sticker.getPackId());
|
||||||
|
this.packKey = Base64.encodeBytes(sticker.getPackKey());
|
||||||
|
this.stickerId = sticker.getStickerId();
|
||||||
|
// TODO also download sticker image ??
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue