Small fixes and cleanup

This commit is contained in:
mjentsch 2015-09-06 22:32:32 +02:00
parent 3dfb1ac17e
commit 31c1037e4d
3 changed files with 11 additions and 11 deletions

View file

@ -679,15 +679,16 @@ static void tgprpl_add_buddy (PurpleConnection * gc, PurpleBuddy * buddy, Purple
static void tgprpl_remove_buddy (PurpleConnection * gc, PurpleBuddy * buddy, PurpleGroup * group) {
debug ("tgprpl_remove_buddy()");
if (!buddy) { return; }
connection_data *conn = purple_connection_get_protocol_data (gc);
tgl_peer_t *peer = find_peer_by_name (conn->TLS, buddy->name);
if (!peer) {
// telegram peer not existing, orphaned buddy
if (!buddy) {
return;
}
connection_data *conn = purple_connection_get_protocol_data (gc);
tgl_peer_t *peer = find_peer_by_name (conn->TLS, buddy->name);
if (!peer) {
return;
}
switch (tgl_get_peer_type(peer->id)) {
case TGL_PEER_ENCR_CHAT:
/* TODO: implement the api call cancel secret chats. Currently the chat will only be marked as

View file

@ -103,7 +103,7 @@ PurpleConversation *p2tgl_got_joined_chat (struct tgl_state *TLS, struct tgl_cha
connection_data *conn = TLS->ev_base;
gchar *alias = p2tgl_strdup_alias ((tgl_peer_t *)chat);
PurpleConversation *conv = serv_got_joined_chat (conn->gc, tgl_get_peer_id(chat->id), alias);
PurpleConversation *conv = serv_got_joined_chat (conn->gc, tgl_get_peer_id (chat->id), alias);
g_free(alias);
return conv;

View file

@ -98,7 +98,7 @@ GList *tgprpl_chat_join_info (PurpleConnection * gc) {
return g_list_append (info, pce);
}
void tgprpl_chat_join (PurpleConnection * gc, GHashTable * data) {
void tgprpl_chat_join (PurpleConnection * gc, GHashTable *data) {
debug ("tgprpl_chat_join()");
connection_data *conn = purple_connection_get_protocol_data (gc);
@ -112,6 +112,7 @@ void tgprpl_chat_join (PurpleConnection * gc, GHashTable * data) {
tgl_do_get_chat_info (conn->TLS, cid, FALSE, tgp_chat_on_loaded_chat_full_joining, NULL);
} else {
warning ("Cannot join chat %d, peer not found...", tgl_get_peer_id (cid));
purple_serv_got_join_chat_failed (gc, data);
}
return;
}
@ -133,8 +134,6 @@ void tgprpl_chat_join (PurpleConnection * gc, GHashTable * data) {
debug ("joining chat by subject %s ...", subject);
tgl_do_get_chat_info (conn->TLS, P->id, FALSE, tgp_chat_on_loaded_chat_full_joining, NULL);
return;
} else {
warning ("Cannot join chat %s, peer not found...", subject);
}
// user creates a new chat by providing its subject the chat join window