diff --git a/telegram-base.c b/telegram-base.c index 2d201d0..d2e0fbb 100644 --- a/telegram-base.c +++ b/telegram-base.c @@ -39,9 +39,9 @@ #include "msglog.h" #include "tgp-2prpl.h" #include "tgp-structs.h" +#include "tgp-utils.h" #include "lodepng/lodepng.h" - #define _(m) m #define DC_SERIALIZED_MAGIC 0x868aa81d #define STATE_FILE_MAGIC 0x28949a93 @@ -637,7 +637,7 @@ void telegram_login (struct tgl_state *TLS) { /** * This function generates a png image to visualize the sha1 key from an encrypted chat. */ -int generate_ident_icon (struct tgl_state *TLS, unsigned char* sha1_key) { +int tgp_visualize_key (struct tgl_state *TLS, unsigned char* sha1_key) { int colors[4] = { 0xffffff, 0xd5e6f3, diff --git a/telegram-base.h b/telegram-base.h index bda1295..ff2dc43 100644 --- a/telegram-base.h +++ b/telegram-base.h @@ -33,7 +33,6 @@ void write_secret_chat_gw (struct tgl_state *TLS, void *extra, int success, stru void telegram_login (struct tgl_state *TLS); void request_code_entered (gpointer data, const gchar *code); -int generate_ident_icon(struct tgl_state *TLS, unsigned char* sha1_key); void request_accept_secret_chat (struct tgl_state *TLS, struct tgl_secret_chat *U); @@ -41,4 +40,6 @@ gchar *get_config_dir (struct tgl_state *TLS, char const *username); gchar *get_download_dir (struct tgl_state *TLS); void assert_file_exists (PurpleConnection *gc, const char *filepath, const char *format); +int tgp_visualize_key(struct tgl_state *TLS, unsigned char* sha1_key); + #endif diff --git a/tgp-2prpl.c b/tgp-2prpl.c index f25f31d..48d134b 100644 --- a/tgp-2prpl.c +++ b/tgp-2prpl.c @@ -390,7 +390,7 @@ PurpleNotifyUserInfo *p2tgl_notify_encrypted_chat_info_new (struct tgl_state *TL } if (secret->first_key_sha[0]) { - int sha1key_store_id = generate_ident_icon (TLS, secret->first_key_sha); + int sha1key_store_id = tgp_visualize_key (TLS, secret->first_key_sha); if (sha1key_store_id != -1) { char *ident_icon = format_img_full (sha1key_store_id); purple_notify_user_info_add_pair (info, "Secret key", ident_icon); diff --git a/tgp-utils.c b/tgp-utils.c index 85376ae..8bfafe6 100644 --- a/tgp-utils.c +++ b/tgp-utils.c @@ -23,6 +23,9 @@ #endif #include "tgp-utils.h" +#include "msglog.h" +#include "lodepng/lodepng.h" + #include #ifdef HAVE_LIBWEBP #include