aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrumeet <yuuta@yuuta.moe>2021-10-12 14:17:10 -0700
committerTrumeet <yuuta@yuuta.moe>2021-10-12 14:17:21 -0700
commit820403924fc017c8ec5b6fdba90a06b8f4eb9b27 (patch)
treea0d2f579523ed0d8582fa5559e591bc3e2ed9ffe
parent0df3150e36f09e267925d02598168d1354563548 (diff)
downloadeasy-tg-820403924fc017c8ec5b6fdba90a06b8f4eb9b27.tar
easy-tg-820403924fc017c8ec5b6fdba90a06b8f4eb9b27.tar.gz
easy-tg-820403924fc017c8ec5b6fdba90a06b8f4eb9b27.tar.bz2
easy-tg-820403924fc017c8ec5b6fdba90a06b8f4eb9b27.zip
don't pass json_object to update handlers
-rw-r--r--easy-tg.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/easy-tg.c b/easy-tg.c
index ff2dd00..e8dc27c 100644
--- a/easy-tg.c
+++ b/easy-tg.c
@@ -141,20 +141,20 @@ cleanup:
return r;
}
-static int handle_update_error(const json_object *json)
+static int handle_update_error()
{
int r = TG_IGNORE;
int code = -1;
const char *msg = NULL;
const char *extra = NULL;
json_object *obj = NULL;
- if(!json_object_object_get_ex(json, "code", &obj))
+ if(!json_object_object_get_ex(tg_update, "code", &obj))
goto cleanup;
code = json_object_get_int(obj);
- if(!json_object_object_get_ex(json, "message", &obj))
+ if(!json_object_object_get_ex(tg_update, "message", &obj))
goto cleanup;
msg = json_object_get_string(obj);
- if(json_object_object_get_ex(json, "@extra", &obj))
+ if(json_object_object_get_ex(tg_update, "@extra", &obj))
extra = json_object_get_string(obj);
tg_errno = code;
tg_reg1 = extra;
@@ -165,11 +165,11 @@ cleanup:
return r;
}
-static int handle_update_authorization_state(const json_object *json)
+static int handle_update_authorization_state()
{
int r = 0;
json_object *obj = NULL;
- if(!json_object_object_get_ex(json, "authorization_state", &obj))
+ if(!json_object_object_get_ex(tg_update, "authorization_state", &obj))
goto cleanup;
json_object *type_obj = NULL;
if(!json_object_object_get_ex(obj, "@type", &type_obj))
@@ -237,11 +237,11 @@ int tg_destroy()
return 0;
}
-static int handle_update_connection_state(const json_object *json)
+static int handle_update_connection_state()
{
int r = TG_IGNORE;
json_object *obj = NULL;
- if(!json_object_object_get_ex(json, "state", &obj) ||
+ if(!json_object_object_get_ex(tg_update, "state", &obj) ||
!json_object_object_get_ex(obj, "@type", &obj))
goto cleanup;
r = TG_CONNECTION;