Mercurial > pidgin.yaz
changeset 9038:095731b5e4f6
[gaim-migrate @ 9814]
Hmm. there's still a compile warning, but at least it compiles now.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Sun, 23 May 2004 19:40:55 +0000 |
parents | 960bb3bd9ba6 |
children | bf4ecb0ae208 |
files | src/protocols/silc/buddy.c src/protocols/silc/chat.c src/protocols/silc/silc.c src/protocols/silc/silcgaim.h |
diffstat | 4 files changed, 80 insertions(+), 62 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/silc/buddy.c Sun May 23 19:39:38 2004 +0000 +++ b/src/protocols/silc/buddy.c Sun May 23 19:40:55 2004 +0000 @@ -417,33 +417,27 @@ } static void -silcgaim_buddy_privkey(GaimBlistNode *node, gpointer data) +silcgaim_buddy_privkey(GaimConnection *gc, const char *name) { - GaimBuddy *b; - GaimConnection *gc; - SilcGaim sg; + SilcGaim sg = gc->proto_data; char *nickname; SilcGaimPrivkey p; SilcClientEntry *clients; SilcUInt32 clients_count; - g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); - - b = (GaimBuddy *) node; - gc = gaim_account_get_connection(b->account); - sg = gc->proto_data; - - if (!silc_parse_userfqdn(b->name, &nickname, NULL)) + if (!name) + return; + if (!silc_parse_userfqdn(name, &nickname, NULL)) return; /* Find client entry */ clients = silc_client_get_clients_local(sg->client, sg->conn, - nickname, b->name, + nickname, name, &clients_count); if (!clients) { silc_client_get_clients(sg->client, sg->conn, nickname, NULL, silcgaim_buddy_privkey_resolved, - g_strdup(b->name)); + g_strdup(name)); silc_free(nickname); return; } @@ -464,6 +458,20 @@ silc_free(nickname); } +static void +silcgaim_buddy_privkey_menu(GaimBlistNode *node, gpointer data) +{ + GaimBuddy *buddy; + GaimConnection *gc; + + g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); + + buddy = (GaimBuddy *) node; + gc = gaim_account_get_connection(buddy->account); + + silcgaim_buddy_privkey(gc, buddy->name); +} + /**************************** Get Public Key *********************************/ @@ -534,36 +542,29 @@ } static void -silcgaim_buddy_getkey(GaimBlistNode *node, gpointer data) +silcgaim_buddy_getkey(GaimConnection *gc, const char *name) { - GaimBuddy *b; - GaimConnection *gc; - SilcGaim sg; - SilcClient client; - SilcClientConnection; + SilcGaim sg = gc->proto_data; + SilcClient client = sg->client; + SilcClientConnection conn = sg->conn; SilcClientEntry *clients; SilcUInt32 clients_count; SilcGaimBuddyGetkey g; char *nickname; - g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); + if (!name) + return; - b = (GaimBuddy *) node; - gc = gaim_account_get_connection(b->account); - sg = gc->proto_data; - client = sg->client; - conn = sg->conn; - - if (!silc_parse_userfqdn(b->name, &nickname, NULL)) + if (!silc_parse_userfqdn(name, &nickname, NULL)) return; /* Find client entry */ - clients = silc_client_get_clients_local(client, conn, nickname, - b->name, &clients_count); + clients = silc_client_get_clients_local(client, conn, nickname, name, + &clients_count); if (!clients) { silc_client_get_clients(client, conn, nickname, NULL, silcgaim_buddy_getkey_resolved, - g_strdup(b->name)); + g_strdup(name)); silc_free(nickname); return; } @@ -585,6 +586,21 @@ } static void +silcgaim_buddy_getkey_menu(GaimBlistNode *node, gpointer data) +{ + GaimBuddy *buddy; + GaimConnection *gc; + + g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); + + buddy = (GaimBuddy *) node; + gc = gaim_account_get_connection(buddy->account); + + silcgaim_buddy_privkey(gc, buddy->name); + +} + +static void silcgaim_buddy_showkey(GaimBlistNode *node, gpointer data) { GaimBuddy *b; @@ -599,7 +615,7 @@ gc = gaim_account_get_connection(b->account); sg = gc->proto_data; - pkfile = gaim_blist_node_get_string(buddy, "public-key"); + pkfile = gaim_blist_node_get_string(node, "public-key"); if (!silc_pkcs_load_public_key(pkfile, &public_key, SILC_PKCS_FILE_PEM) && !silc_pkcs_load_public_key(pkfile, &public_key, SILC_PKCS_FILE_BIN)) { gaim_notify_error(gc, @@ -1558,7 +1574,7 @@ } static void -silcgaim_buddy_kill(GaimBlistNode *buddy, gpointer data) +silcgaim_buddy_kill(GaimBlistNode *node, gpointer data) { GaimBuddy *b; GaimConnection *gc; @@ -1576,7 +1592,7 @@ } static void -silcgaim_buddy_send_file(GaimBlistNode *buddy, gpointer data) +silcgaim_buddy_send_file(GaimBlistNode *node, gpointer data) { GaimBuddy *b; GaimConnection *gc; @@ -1600,44 +1616,44 @@ GaimBlistNodeAction *act; GList *m = NULL; - pkfile = gaim_blist_node_get_string(node, "public-key"); + pkfile = gaim_blist_node_get_string((GaimBlistNode *) buddy, "public-key"); client_entry = silc_client_get_client_by_id(sg->client, sg->conn, - b->proto_data); + buddy->proto_data); if (client_entry && client_entry->send_key) { act = gaim_blist_node_action_new(_("Reset IM Key"), - silcgaim_buddy_resetkey); + silcgaim_buddy_resetkey, NULL); m = g_list_append(m, act); } else { act = gaim_blist_node_action_new(_("IM with Key Exchange"), - silcgaim_buddy_keyagr); + silcgaim_buddy_keyagr, NULL); m = g_list_append(m, act); act = gaim_blist_node_action_new(_("IM with Password"), - silcgaim_buddy_privkey); + silcgaim_buddy_privkey_menu, NULL); m = g_list_append(m, act); } if (pkfile) { act = gaim_blist_node_action_new(_("Show Public Key"), - silcgaim_buddy_showkey); + silcgaim_buddy_showkey, NULL); m = g_list_append(m, act); } else { act = gaim_blist_node_action_new(_("Get Public Key..."), - silcgaim_buddy_getkey); + silcgaim_buddy_getkey_menu, NULL); m = g_list_append(m, act); } act = gaim_blist_node_action_new(_("Send File..."), - silcgaim_buddy_send_file); + silcgaim_buddy_send_file, NULL); m = g_list_append(m, act); if (conn && conn->local_entry->mode & SILC_UMODE_ROUTER_OPERATOR) { act = gaim_blist_node_action_new(_("Kill User"), - silcgaim_buddy_kill); + silcgaim_buddy_kill, NULL); m = g_list_append(m, act); }
--- a/src/protocols/silc/chat.c Sun May 23 19:39:38 2004 +0000 +++ b/src/protocols/silc/chat.c Sun May 23 19:40:55 2004 +0000 @@ -43,7 +43,7 @@ } static void -silcgaim_chat_getinfo(GaimBlistNode *node, gpointer data); +silcgaim_chat_getinfo(GaimConnection *gc, GHashTable *components); static void silcgaim_chat_getinfo_res(SilcClient client, @@ -72,13 +72,11 @@ silcgaim_chat_getinfo(gc, components); } + static void -silcgaim_chat_getinfo(GaimBlistNode *node, gpointer data) +silcgaim_chat_getinfo(GaimConnection *gc, GHashTable *components) { - GaimChat *chat; - GaimConnection *gc; - SilcGaim sg; - + SilcGaim sg = gc->proto_data; const char *chname; char *buf, tmp[256]; GString *s; @@ -86,13 +84,10 @@ SilcHashTableList htl; SilcChannelUser chu; - g_return_if_fail(GAIM_BLIST_NODE_IS_CHAT(node)); + if (!components) + return; - chat = (GaimChat *) node; - gc = gaim_account_get_connection(chat->account); - sg = gc->proto_data; - - chname = g_hash_table_lookup(chat->components, "channel"); + chname = g_hash_table_lookup(components, "channel"); if (!chname) return; channel = silc_client_get_channel(sg->client, sg->conn, @@ -101,7 +96,7 @@ silc_client_get_channel_resolve(sg->client, sg->conn, (char *)chname, silcgaim_chat_getinfo_res, - chat->components); + components); return; } @@ -163,6 +158,13 @@ } +static void +silcgaim_chat_getinfo_menu(GaimBlistNode *node, gpointer data) +{ + +} + + #if 0 /* XXX For now these are not implemented. We need better listview dialog from Gaim for these. */ /************************** Channel Invite List ******************************/ @@ -818,7 +820,7 @@ GList *silcgaim_chat_menu(GaimChat *chat) { - GHashTable components = chat->components; + GHashTable *components = chat->components; GaimConnection *gc = gaim_account_get_connection(chat->account); SilcGaim sg = gc->proto_data; SilcClientConnection conn = sg->conn; @@ -827,7 +829,7 @@ SilcChannelUser chu = NULL; SilcUInt32 mode = 0; - GList *m; + GList *m = NULL; GaimBlistNodeAction *act; if (components) @@ -845,7 +847,7 @@ return NULL; act = gaim_blist_node_action_new(_("Get Info"), - silcgaim_chat_getinfo, NULL); + silcgaim_chat_getinfo_menu, NULL); m = g_list_append(m, act); #if 0 /* XXX For now these are not implemented. We need better
--- a/src/protocols/silc/silc.c Sun May 23 19:39:38 2004 +0000 +++ b/src/protocols/silc/silc.c Sun May 23 19:40:55 2004 +0000 @@ -885,11 +885,11 @@ original: one for buddies and one for chats */ if(GAIM_BLIST_NODE_IS_CHAT(node)) { - return silcgaim_chat_menu((GaimChar *) node); + return silcgaim_chat_menu((GaimChat *) node); } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) { return silcgaim_buddy_menu((GaimBuddy *) node); } else { - return_val_if_reached(NULL); + g_return_val_if_reached(NULL); } }
--- a/src/protocols/silc/silcgaim.h Sun May 23 19:39:38 2004 +0000 +++ b/src/protocols/silc/silcgaim.h Sun May 23 19:40:55 2004 +0000 @@ -86,7 +86,7 @@ unsigned char *pk, SilcUInt32 pk_len, SilcSKEPKType pk_type, SilcVerifyPublicKey completion, void *context); -GList *silcgaim_buddy_menu(GaimConnection *gc, const char *name); +GList *silcgaim_buddy_menu(GaimBuddy *buddy); void silcgaim_add_buddy(GaimConnection *gc, const char *name, GaimGroup *grp); void silcgaim_add_buddies(GaimConnection *gc, GList *buddies); void silcgaim_remove_buddy(GaimConnection *gc, const char *name, @@ -116,7 +116,7 @@ void silcgaim_get_chumode_string(SilcUInt32 mode, char *buf, SilcUInt32 buf_size); GList *silcgaim_chat_info(GaimConnection *gc); -GList *silcgaim_chat_menu(GaimConnection *gc, GHashTable *components); +GList *silcgaim_chat_menu(GaimChat *); void silcgaim_chat_join(GaimConnection *gc, GHashTable *data); void silcgaim_chat_invite(GaimConnection *gc, int id, const char *msg, const char *name);