Currently, reply_to field for any event is set to NULL as we haven't created any mechanism to parse replied message.
Sample of event can be taken from text message:
struct tgev {
/*
* We need to hold the JSON object to release
* the resource, as it holds the reference
* to `const char *`.
*
* It hurts the performance if we allocate
* new memory and copy it. So let it here.
*/
json_object *json;
uint64_t update_id;
tgev_type_t type;
struct_pad(0, 4);
union {
struct tgev_gif msg_gif;
struct tgev_text msg_text;
struct tgev_photo msg_photo;
struct tgev_sticker msg_sticker;
};
};
struct tgev_text {
uint64_t msg_id;
struct tgevi_from from;
struct tgevi_from forward_from;
const char *fwd_sender_name;
struct tgevi_chat chat;
struct tgevi_chat sender_chat;
time_t date;
time_t forward_date;
const char *text;
uint16_t entity_c; /* How many entities[n] there are? */
struct tgevi_entity *entities;
struct tgev *reply_to;
bool is_forwarded;
bool is_unknown_fwd;
};
reply_to contains a pointer struct tgev, which means if the JSON keys are completely identical, we can use recursive call inside event parser.
TODO List
[x] Make sure replied message has identical JSON keys.
Short technical explanation
Currently,
reply_to
field for any event is set toNULL
as we haven't created any mechanism to parse replied message.Sample of event can be taken from text message:
reply_to
contains a pointerstruct tgev
, which means if the JSON keys are completely identical, we can use recursive call inside event parser.TODO List
reply_to
recursive parser.