Skip to content

Commit

Permalink
do not care about element type, just to string
Browse files Browse the repository at this point in the history
  • Loading branch information
MrXiaoM committed Jan 16, 2024
1 parent f0892b3 commit 3cd646a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,7 @@ public ForwardMsgResp deserialize(JsonElement json, Type typeOfT, JsonDeserializ
int messageId = obj.optInt("message_id");
int realId = obj.optInt("real_id");
ForwardMsgResp.Sender sender = gson.fromJson(obj.optJSONObject("anonymous"), ForwardMsgResp.Sender.class);
String message;
if (obj.getJsonElement("message").isJsonArray()) {
message = gson.toJson(obj.optJSONArray("message"));
} else {
message = obj.optString("message");
}
String message = gson.toJson(obj.getJsonElement("message"));
long peerId = obj.optLong("peer_id");
long targetId = obj.optLong("target_id");
nodes.add(new ForwardMsgResp.Node(time, messageType, messageId, realId, peerId, targetId, sender, message));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@ public MessageEvent deserialize(JsonElement json, Type typeOfT, JsonDeserializat
JsonObject obj = json.getAsJsonObject();
String messageType = obj.get("message_type").getAsString();
long userId = obj.get("user_id").getAsLong();
String message;
if (obj.get("message").isJsonArray()) {
message = gson.toJson(obj.get("message").getAsJsonArray());
} else {
message = obj.get("message").getAsString();
}
String message = gson.toJson(obj.get("message"));
String rawMessage = obj.get("raw_message").getAsString();
int font = obj.get("font").getAsInt();
switch (messageType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@ public GetMsgResp deserialize(JsonElement json, Type typeOfT, JsonDeserializatio
int realId = obj.get("real_id").getAsInt();
GetMsgResp.Sender sender = gson.fromJson(obj.get("sender"), GetMsgResp.Sender.class);
int time = obj.get("time").getAsInt();
String message;
if (obj.get("message").isJsonArray()) {
message = gson.toJson(obj.get("message").getAsJsonArray());
} else {
message = obj.get("message").getAsString();
}
String message = gson.toJson(obj.get("message"));
String rawMessage = obj.has("raw_message") ? obj.get("raw_message").getAsString() : "";
long peerId = obj.has("peer_id") ? obj.get("peer_id").getAsLong() : 0;
long groupId = obj.has("group_id") ? obj.get("group_id").getAsLong() : 0;
Expand Down

0 comments on commit 3cd646a

Please sign in to comment.