From: Don S. <ri...@us...> - 2005-12-23 19:15:14
|
Update of /cvsroot/gaim-bnet/gaim-bnet/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23701/src Modified Files: bnet.c buddy.c buddy.h chat.c chat.h proto.c Log Message: Changes for gaim 2.0 API, still need to actually test running. It compiles and loads now, anyhow. Index: buddy.h =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/buddy.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** buddy.h 2 Mar 2005 22:39:47 -0000 1.11 --- buddy.h 23 Dec 2005 19:15:05 -0000 1.12 *************** *** 69,73 **** BNetBuddy *bnet_buddy_hard_lookup(BNetConn *conn, const gchar *name); void bnet_buddy_remove(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group); ! void bnet_buddy_emblems(GaimBuddy *buddy, char **se, char **sw, char **nw, char **ne); gchar *bnet_buddy_tooltip_text(GaimBuddy *b); void bnet_buddy_set_info(BNetBuddy *b, const gchar *game, const gchar *location); --- 69,73 ---- BNetBuddy *bnet_buddy_hard_lookup(BNetConn *conn, const gchar *name); void bnet_buddy_remove(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group); ! void bnet_buddy_emblems(GaimBuddy *buddy, const char **se, const char **sw, const char **nw, const char **ne); gchar *bnet_buddy_tooltip_text(GaimBuddy *b); void bnet_buddy_set_info(BNetBuddy *b, const gchar *game, const gchar *location); Index: chat.h =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/chat.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** chat.h 26 Sep 2005 09:23:56 -0000 1.3 --- chat.h 23 Dec 2005 19:15:05 -0000 1.4 *************** *** 29,37 **** void bnet_register_commands(); ! gint bnet_chat_send_im(GaimConnection *gc, const gchar *who, const gchar *what, GaimConvImFlags imflags); GList *bnet_chat_info(GaimConnection *gc); void bnet_chat_join(GaimConnection *gc, GHashTable *data); void bnet_chat_leave(GaimConnection *gc, int id); ! int bnet_chat_send(GaimConnection *gc, int id, const char *what); --- 29,37 ---- void bnet_register_commands(); ! gint bnet_chat_send_im(GaimConnection *gc, const gchar *who, const gchar *what, GaimMessageFlags flags); GList *bnet_chat_info(GaimConnection *gc); void bnet_chat_join(GaimConnection *gc, GHashTable *data); void bnet_chat_leave(GaimConnection *gc, int id); ! int bnet_chat_send(GaimConnection *gc, int id, const char *what, GaimMessageFlags flags); Index: chat.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/chat.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** chat.c 26 Sep 2005 09:23:56 -0000 1.7 --- chat.c 23 Dec 2005 19:15:05 -0000 1.8 *************** *** 153,157 **** gint bnet_chat_send_im(GaimConnection *gc, const gchar *who, const gchar *what, ! GaimConvImFlags imflags) { BNetConn *conn; --- 153,157 ---- gint bnet_chat_send_im(GaimConnection *gc, const gchar *who, const gchar *what, ! GaimMessageFlags flags) { BNetConn *conn; *************** *** 203,207 **** serv_got_joined_chat(gc, ++conn->chan_id, chan); ! convo = gaim_find_conversation_with_account(conn->chan, conn->account); g_return_if_fail(convo); --- 203,207 ---- serv_got_joined_chat(gc, ++conn->chan_id, chan); ! convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, conn->chan, conn->account); g_return_if_fail(convo); *************** *** 209,213 **** } else { ! convo = gaim_find_conversation_with_account(conn->chan, conn->account); if (convo) { --- 209,213 ---- } else { ! convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, conn->chan, conn->account); if (convo) { *************** *** 229,233 **** int ! bnet_chat_send(GaimConnection *gc, int id, const char *what) { BNetConn *conn; GaimConversation *convo; --- 229,233 ---- int ! bnet_chat_send(GaimConnection *gc, int id, const char *what, GaimMessageFlags flags) { BNetConn *conn; GaimConversation *convo; Index: buddy.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/buddy.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** buddy.c 2 Mar 2005 22:39:47 -0000 1.18 --- buddy.c 23 Dec 2005 19:15:05 -0000 1.19 *************** *** 233,237 **** void ! bnet_buddy_emblems(GaimBuddy *b, char **se, char **sw, char **nw, char **ne) { BNetConn *conn; BNetBuddy *bb; --- 233,237 ---- void ! bnet_buddy_emblems(GaimBuddy *b, const char **se, const char **sw, const char **nw, const char **ne) { BNetConn *conn; BNetBuddy *bb; *************** *** 246,250 **** emblems[i++] = "notauthorized"; } else { ! if (b->present == GAIM_BUDDY_OFFLINE) { emblems[i++] = "offline"; } else { --- 246,251 ---- emblems[i++] = "notauthorized"; } else { ! //if (b->present == GAIM_BUDDY_OFFLINE) { ! if (!GAIM_BUDDY_IS_ONLINE(b)) { emblems[i++] = "offline"; } else { *************** *** 270,273 **** --- 271,275 ---- if ((bb = g_hash_table_lookup(conn->buddies, norm))) { + /* switch (b->present) { case GAIM_BUDDY_SIGNING_OFF: *************** *** 294,297 **** --- 296,315 ---- break; } + */ + + if (GAIM_BUDDY_IS_ONLINE(b)) { + g_string_append_printf(ret, + "\n<b>%s</b>: %s", _("Status"), _("Online")); + + if (bb->game) + g_string_append_printf(ret, + "\n<b>%s:</b> %s", _("Game"), bb->game); + if (bb->location) + g_string_append_printf(ret, + "\n<b>%s:</b> %s", _("Location"), bb->location); + } else { + g_string_append_printf(ret, + "\n<b>%s</b>: %s", _("Status"), _("Offline")); + } } else { g_string_append_printf(ret, Index: bnet.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/bnet.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** bnet.c 26 Sep 2005 09:23:56 -0000 1.39 --- bnet.c 23 Dec 2005 19:15:05 -0000 1.40 *************** *** 131,151 **** act = gaim_blist_node_action_new(_("StarCraft Stats"), ! bnet_user_stats, "STAR"); m = g_list_append(m, act); act = gaim_blist_node_action_new(_("StarCraft Broodwar Stats"), ! bnet_user_stats, "SEXP"); m = g_list_append(m, act); act = gaim_blist_node_action_new(_("WarCraft II Battle.net Edition Stats"), ! bnet_user_stats, "W2BN"); m = g_list_append(m, act); act = gaim_blist_node_action_new(_("WarCraft III Stats"), ! bnet_user_stats, "WAR3"); m = g_list_append(m, act); act = gaim_blist_node_action_new(_("WarCraft III The Frozen Throne Stats"), ! bnet_user_stats, "W3XP"); m = g_list_append(m, act); --- 131,151 ---- act = gaim_blist_node_action_new(_("StarCraft Stats"), ! bnet_user_stats, "STAR", NULL); m = g_list_append(m, act); act = gaim_blist_node_action_new(_("StarCraft Broodwar Stats"), ! bnet_user_stats, "SEXP", NULL); m = g_list_append(m, act); act = gaim_blist_node_action_new(_("WarCraft II Battle.net Edition Stats"), ! bnet_user_stats, "W2BN", NULL); m = g_list_append(m, act); act = gaim_blist_node_action_new(_("WarCraft III Stats"), ! bnet_user_stats, "WAR3", NULL); m = g_list_append(m, act); act = gaim_blist_node_action_new(_("WarCraft III The Frozen Throne Stats"), ! bnet_user_stats, "W3XP", NULL); m = g_list_append(m, act); *************** *** 153,160 **** } ! static GList *bnet_away_states(GaimConnection *gc) { ! return g_list_append(NULL, (gpointer)GAIM_AWAY_CUSTOM); ! } ! static void bnet_set_away(GaimConnection *gc, const char *state, const char *msg) { BNetConn *conn = BNET_CONN(gc->proto_data); --- 153,157 ---- } ! /* static void bnet_set_away(GaimConnection *gc, const char *state, const char *msg) { BNetConn *conn = BNET_CONN(gc->proto_data); *************** *** 171,174 **** --- 168,172 ---- bnet_conn_send(conn, "/away\n"); } + */ *************** *** 208,270 **** } static GaimPluginProtocolInfo prpl_info = { ! OPT_PROTO_PASSWORD_OPTIONAL, /* options */ ! NULL, /* user_splits */ ! NULL, /* protocol_options */ ! NO_BUDDY_ICONS, /* icon_spec */ ! bnet_icon, /* list_icon */ ! bnet_buddy_emblems, /* list_emblems */ ! NULL, /* status_text */ ! bnet_buddy_tooltip_text, /* tooltip_text */ ! bnet_away_states, /* away_states */ ! blist_node_menu, /* blist_node_menu */ ! bnet_chat_info, /* chat_info */ ! NULL, /* chat_info_defaults */ ! bnet_conn_login, /* login */ ! bnet_conn_close, /* close */ ! bnet_chat_send_im, /* send_im */ ! NULL, /* set_info */ ! NULL, /* send_typing */ ! bnet_user_info, /* get_info */ ! bnet_set_away, /* set_away */ ! NULL, /* set_idle */ ! NULL, /* change_password */ ! bnet_buddy_add, /* add_buddy */ ! NULL, /* add_buddies */ ! bnet_buddy_remove, /* remove_buddy */ ! NULL, /* remove_buddies */ ! NULL, /* add_permit */ ! bnet_user_squelch, /* add_deny */ ! NULL, /* rem_permit */ ! bnet_user_unsquelch, /* rem_deny */ ! bnet_set_permit_deny, /* set_permit_deny */ ! NULL, /* warn */ ! bnet_chat_join, /* join_chat */ ! NULL, /* reject_chat */ ! NULL, /* get_chat_name */ ! NULL, /* chat_invite */ ! bnet_chat_leave, /* chat_leave */ ! NULL, /* chat_whisper */ ! bnet_chat_send, /* chat_send */ ! NULL, /* keepalive */ ! NULL, /* register_user */ ! NULL, /* get_cb_info */ ! NULL, /* get_cb_away */ ! NULL, /* alias_buddy */ ! NULL, /* group_buddy */ ! NULL, /* rename_group */ ! NULL, /* buddy_free */ ! NULL, /* convo_closed */ ! NULL, /* normalize */ ! NULL, /* set_buddy_icon */ ! NULL, /* remove_group */ ! NULL, /* get_cb_real_name */ ! NULL, /* set_chat_topic */ ! NULL, /* find_blist_chat */ ! NULL, /* roomlist_get_list */ ! NULL, /* roomlist_cancel */ ! NULL, /* roomlist_expand_category */ ! NULL, /* can_receive_file */ ! NULL /* send_file */ }; --- 206,321 ---- } + + static GList *bnet_status_types(GaimAccount *account) { + GaimStatusType *status; + GList *types = NULL; + + status = gaim_status_type_new_full(GAIM_STATUS_OFFLINE, + NULL, NULL, FALSE, TRUE, FALSE); + types = g_list_append(types, status); + + status = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE, + NULL, NULL, FALSE, TRUE, FALSE); + types = g_list_append(types, status); + + status = gaim_status_type_new_with_attrs( + GAIM_STATUS_AWAY, NULL, NULL, TRUE, TRUE, FALSE, + "message", _("Message"), gaim_value_new(GAIM_TYPE_STRING), + NULL); + types = g_list_append(types, status); + + return types; + } + + + static void bnet_set_status(GaimAccount *account, GaimStatus *status) { + GaimConnection *gc = gaim_account_get_connection(account); + + //BNetConn *conn = BNET_CONN(gc->proto_data); + BNetConn *conn = NULL; + const char *args[1]; + const char *status_id = gaim_status_get_id(status); + + if (gc) + conn = BNET_CONN(gc->proto_data); + + if (!gaim_status_is_active(status)) + return; + + args[0] = NULL; + + if (!strcmp(status_id, "away")) { + args[0] = gaim_status_get_attr_string(status, "message"); + if ((args[0] == NULL) || (*args[0] == '\0')) + args[0] = _("Away"); + //irc_cmd_away(irc, "away", NULL, args); + bnet_conn_send(conn, "/away %s\n", args[0]); + } else if (!strcmp(status_id, "available")) { + //irc_cmd_away(irc, "back", NULL, args); + bnet_conn_send(conn, "/away\n"); + } + + } + + + static GaimPluginProtocolInfo prpl_info = { ! OPT_PROTO_PASSWORD_OPTIONAL, /* options */ ! NULL, /* user_splits */ ! NULL, /* protocol_options */ ! NO_BUDDY_ICONS, /* icon_spec */ ! bnet_icon, /* list_icon */ ! bnet_buddy_emblems, /* list_emblems */ ! NULL, /* status_text */ ! bnet_buddy_tooltip_text, /* tooltip_text */ ! bnet_status_types, /* status_types */ ! blist_node_menu, /* blist_node_menu */ ! bnet_chat_info, /* chat_info */ ! NULL, /* chat_info_defaults */ ! bnet_conn_login, /* login */ ! bnet_conn_close, /* close */ ! bnet_chat_send_im, /* send_im */ ! NULL, /* set_info */ ! NULL, /* send_typing */ ! bnet_user_info, /* get_info */ ! bnet_set_status, /* set_status */ ! NULL, /* set_idle */ ! NULL, /* change_password */ ! bnet_buddy_add, /* add_buddy */ ! NULL, /* add_buddies */ ! bnet_buddy_remove, /* remove_buddy */ ! NULL, /* remove_buddies */ ! NULL, /* add_permit */ ! bnet_user_squelch, /* add_deny */ ! NULL, /* rem_permit */ ! bnet_user_unsquelch, /* rem_deny */ ! bnet_set_permit_deny, /* set_permit_deny */ ! bnet_chat_join, /* join_chat */ ! NULL, /* reject_chat */ ! NULL, /* get_chat_name */ ! NULL, /* chat_invite */ ! bnet_chat_leave, /* chat_leave */ ! NULL, /* chat_whisper */ ! bnet_chat_send, /* chat_send */ ! NULL, /* keepalive */ ! NULL, /* register_user */ ! NULL, /* get_cb_info */ ! NULL, /* get_cb_away */ ! NULL, /* alias_buddy */ ! NULL, /* group_buddy */ ! NULL, /* rename_group */ ! NULL, /* buddy_free */ ! NULL, /* convo_closed */ ! NULL, /* normalize */ ! NULL, /* set_buddy_icon */ ! NULL, /* remove_group */ ! NULL, /* get_cb_real_name */ ! NULL, /* set_chat_topic */ ! NULL, /* find_blist_chat */ ! NULL, /* roomlist_get_list */ ! NULL, /* roomlist_cancel */ ! NULL, /* roomlist_expand_category */ ! NULL, /* can_receive_file */ ! NULL /* send_file */ }; *************** *** 273,299 **** GAIM_MAJOR_VERSION, GAIM_MINOR_VERSION, ! GAIM_PLUGIN_PROTOCOL, /* type */ ! NULL, /* ui_requirement */ ! 0, /* flags */ ! NULL, /* dependencies */ ! GAIM_PRIORITY_DEFAULT, /* priority */ ! "prpl-bnet", /* id */ ! NULL, /* name */ #ifdef _WIN32 ! BN_VERSION, /* version */ #else ! VERSION, /* version */ #endif ! NULL, /* summary */ ! NULL, /* description */ ! "Gary Kramlich, Don Seiler, Dario Zilocchi, Daniel Atallah", /* author */ ! BNET_WEBSITE, /* homepage */ ! NULL, /* load */ ! NULL, /* unload */ ! NULL, /* destroy */ ! NULL, /* ui_info */ ! &prpl_info, /* extra_info */ ! NULL, /* prefs_info */ ! bnet_actions /* actions */ }; --- 324,350 ---- GAIM_MAJOR_VERSION, GAIM_MINOR_VERSION, ! GAIM_PLUGIN_PROTOCOL, /* type */ ! NULL, /* ui_requirement */ ! 0, /* flags */ ! NULL, /* dependencies */ ! GAIM_PRIORITY_DEFAULT, /* priority */ ! "prpl-bnet", /* id */ ! NULL, /* name */ #ifdef _WIN32 ! BN_VERSION, /* version */ #else ! VERSION, /* version */ #endif ! NULL, /* summary */ ! NULL, /* description */ ! "Gary Kramlich, Don Seiler, Dario Zilocchi, Daniel Atallah", /* author */ ! BNET_WEBSITE, /* homepage */ ! NULL, /* load */ ! NULL, /* unload */ ! NULL, /* destroy */ ! NULL, /* ui_info */ ! &prpl_info, /* extra_info */ ! NULL, /* prefs_info */ ! bnet_actions /* actions */ }; Index: proto.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/proto.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** proto.c 26 Sep 2005 09:23:56 -0000 1.27 --- proto.c 23 Dec 2005 19:15:05 -0000 1.28 *************** *** 34,37 **** --- 34,38 ---- #include "proto.h" #include "buddy.h" + #include <connection.h> #define IS_NUM(c) ((c) >= '0' && (c) <= '9') *************** *** 167,171 **** gc = gaim_account_get_connection(conn->account); ! serv_got_update(gc, nick, TRUE, 0, 0, 0, 0); bnet_conn_send(conn, "/where %s\n", nick); --- 168,173 ---- gc = gaim_account_get_connection(conn->account); ! //serv_got_update(gc, nick, TRUE, 0, 0, 0, 0); ! gaim_prpl_got_user_status(gaim_connection_get_account(gc), nick, "available", NULL); bnet_conn_send(conn, "/where %s\n", nick); *************** *** 198,202 **** gc = gaim_account_get_connection(conn->account); ! serv_got_update(gc, nick, FALSE, 0, 0, 0, 0); } --- 200,205 ---- gc = gaim_account_get_connection(conn->account); ! //serv_got_update(gc, nick, FALSE, 0, 0, 0, 0); ! gaim_prpl_got_user_status(gaim_connection_get_account(gc), nick, "offline", NULL); } *************** *** 249,253 **** gc = gaim_account_get_connection(conn->account); ! serv_got_update(gc, nick, online, 0, 0, 0, 0); return FALSE; --- 252,261 ---- gc = gaim_account_get_connection(conn->account); ! //serv_got_update(gc, nick, online, 0, 0, 0, 0); ! if (online) { ! gaim_prpl_got_user_status(conn->account, nick, "available", NULL); ! } else { ! gaim_prpl_got_user_status(conn->account, nick, "offline", NULL); ! } return FALSE; *************** *** 360,364 **** */ gc = gaim_account_get_connection(conn->account); ! serv_got_update(gc, nick, TRUE, 0, 0, 0, 0); norm = gaim_normalize(conn->account, nick); --- 368,373 ---- */ gc = gaim_account_get_connection(conn->account); ! //serv_got_update(gc, nick, TRUE, 0, 0, 0, 0); ! gaim_prpl_got_user_status(conn->account, nick, "available", NULL); norm = gaim_normalize(conn->account, nick); *************** *** 575,579 **** } ! convo = gaim_find_conversation_with_account(conn->chan, conn->account); if (convo) { gaim_conv_chat_add_user(GAIM_CONV_CHAT(convo), --- 584,588 ---- } ! convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, conn->chan, conn->account); if (convo) { gaim_conv_chat_add_user(GAIM_CONV_CHAT(convo), *************** *** 605,609 **** g_hash_table_remove(conn->users, norm); ! convo = gaim_find_conversation_with_account(conn->chan, conn->account); if (convo) { if (gaim_conv_chat_find_user(GAIM_CONV_CHAT(convo), nick)) --- 614,618 ---- g_hash_table_remove(conn->users, norm); ! convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, conn->chan, conn->account); if (convo) { if (gaim_conv_chat_find_user(GAIM_CONV_CHAT(convo), nick)) *************** *** 654,658 **** GaimConversation *convo; ! convo = gaim_find_conversation_with_account(conn->chan, conn->account); if (convo) { gaim_conv_chat_write(GAIM_CONV_CHAT(convo), nick, msg, 0, time(0)); --- 663,667 ---- GaimConversation *convo; ! convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, conn->chan, conn->account); if (convo) { gaim_conv_chat_write(GAIM_CONV_CHAT(convo), nick, msg, 0, time(0)); *************** *** 678,682 **** g_hash_table_foreach_remove(conn->users, bnet_hash_destroy_all, NULL); ! convo = gaim_find_conversation_with_account(chan, conn->account); if (convo) { /* Use the old window */ --- 687,691 ---- g_hash_table_foreach_remove(conn->users, bnet_hash_destroy_all, NULL); ! convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, chan, conn->account); if (convo) { /* Use the old window */ *************** *** 733,737 **** GaimConversation *conv; ! conv = gaim_find_conversation_with_account(conn->chan, conn->account); if (conv) { gaim_conv_chat_write(GAIM_CONV_CHAT(conv), "", --- 742,746 ---- GaimConversation *conv; ! conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, conn->chan, conn->account); if (conv) { gaim_conv_chat_write(GAIM_CONV_CHAT(conv), "", *************** *** 768,772 **** GaimConversation *conv; ! conv = gaim_find_conversation_with_account(conn->chan, conn->account); if (conv) { gaim_conv_chat_write(GAIM_CONV_CHAT(conv), "", error, --- 777,781 ---- GaimConversation *conv; ! conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, conn->chan, conn->account); if (conv) { gaim_conv_chat_write(GAIM_CONV_CHAT(conv), "", error, *************** *** 795,799 **** buf = g_strdup_printf("/me %s", msg); ! convo = gaim_find_conversation_with_account(conn->chan, conn->account); if (convo) { gaim_conv_chat_write(GAIM_CONV_CHAT(convo), nick, buf, 0, time(0)); --- 804,808 ---- buf = g_strdup_printf("/me %s", msg); ! convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, conn->chan, conn->account); if (convo) { gaim_conv_chat_write(GAIM_CONV_CHAT(convo), nick, buf, 0, time(0)); |