Use better names

This commit is contained in:
mjentsch 2015-10-17 23:11:15 +02:00
parent bd7662aaeb
commit d43f4f0d64
3 changed files with 6 additions and 6 deletions

View file

@ -25,7 +25,7 @@
#include <assert.h>
const char *tgp_blist_peer_get_purple_name (struct tgl_state *TLS, tgl_peer_id_t id) {
const char *name = g_hash_table_lookup (tg_get_data (TLS)->id_to_tgl_peer, GINT_TO_POINTER(tgl_get_peer_id (id)));
const char *name = g_hash_table_lookup (tg_get_data (TLS)->id_to_purple_name, GINT_TO_POINTER(tgl_get_peer_id (id)));
if (! name) {
assert (0);
return NULL;
@ -34,8 +34,8 @@ const char *tgp_blist_peer_get_purple_name (struct tgl_state *TLS, tgl_peer_id_t
}
void tgp_blist_peer_add_purple_name (struct tgl_state *TLS, tgl_peer_id_t id, const char *purple_name) {
assert (g_hash_table_lookup (tg_get_data (TLS)->id_to_tgl_peer, GINT_TO_POINTER(tgl_get_peer_id (id))) == NULL);
g_hash_table_insert (tg_get_data (TLS)->id_to_tgl_peer, GINT_TO_POINTER(tgl_get_peer_id (id)),
assert (g_hash_table_lookup (tg_get_data (TLS)->id_to_purple_name, GINT_TO_POINTER(tgl_get_peer_id (id))) == NULL);
g_hash_table_insert (tg_get_data (TLS)->id_to_purple_name, GINT_TO_POINTER(tgl_get_peer_id (id)),
g_strdup (purple_name));
}

View file

@ -101,7 +101,7 @@ connection_data *connection_data_init (struct tgl_state *TLS, PurpleConnection *
conn->out_messages = g_queue_new ();
conn->pending_reads = g_queue_new ();
conn->pending_chat_info = g_hash_table_new (g_direct_hash, g_direct_equal);
conn->id_to_tgl_peer = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);
conn->id_to_purple_name = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);
return conn;
}
@ -115,7 +115,7 @@ void *connection_data_free (connection_data *conn) {
tgp_g_queue_free_full (conn->out_messages, tgp_msg_sending_free);
tgp_g_list_free_full (conn->used_images, used_image_free);
g_hash_table_destroy (conn->pending_chat_info);
g_hash_table_destroy (conn->id_to_tgl_peer);
g_hash_table_destroy (conn->id_to_purple_name);
tgprpl_xfer_free_all (conn);
tgl_free_all (conn->TLS);
g_free(conn->TLS->base_path);

View file

@ -43,7 +43,7 @@ typedef struct {
int password_retries;
PurpleRoomlist *roomlist;
GHashTable *pending_chat_info;
GHashTable *id_to_tgl_peer;
GHashTable *id_to_purple_name;
} connection_data;
typedef struct {