# HG changeset patch # User Tim Ringenbach # Date 1098150380 0 # Node ID 2a2cd2a6f7cf3f699dbecc52be39c3c279f830f3 # Parent ab8e8069b71e4356ac6dab9d2ffa7faaefb2fc6e [gaim-migrate @ 11156] bleeter added /join and /buzz commands for yahoo. committer: Tailor Script diff -r ab8e8069b71e -r 2a2cd2a6f7cf src/protocols/yahoo/yahoo.c --- a/src/protocols/yahoo/yahoo.c Tue Oct 19 00:04:59 2004 +0000 +++ b/src/protocols/yahoo/yahoo.c Tue Oct 19 01:46:20 2004 +0000 @@ -26,6 +26,7 @@ #include "account.h" #include "accountopt.h" #include "blist.h" +#include "cmds.h" #include "debug.h" #include "notify.h" #include "privacy.h" @@ -3383,8 +3384,69 @@ g_free(gpo); } +static GaimCmdRet +yahoogaim_cmd_buzz(GaimConversation *c, const gchar *cmd, gchar **args, gchar **error, void *data) { + + GaimAccount *account = gaim_conversation_get_account(c); + const char *username = gaim_account_get_username(account); + + if (*args && args[0]) + return GAIM_CMD_RET_FAILED; + + gaim_debug(GAIM_DEBUG_INFO, "yahoo", + "Sending on account %s to buddy %s.\n", username, c->name); + gaim_conv_im_send(GAIM_CONV_IM(c), ""); + gaim_conv_im_write(GAIM_CONV_IM(c), "", _("Buzz!!"), GAIM_MESSAGE_NICK|GAIM_MESSAGE_RECV, time(NULL)); + return GAIM_CMD_RET_OK; +} + static GaimPlugin *my_protocol = NULL; +/********************************* Commands **********************************/ + +static GaimCmdRet +yahoogaim_cmd_chat_join(GaimConversation *conv, const char *cmd, + char **args, char **error, void *data) +{ + GHashTable *comp; + GaimConnection *gc; + struct yahoo_data *yd; + int id; + + if (!args || !args[0]) + return GAIM_CMD_RET_FAILED; + + gc = gaim_conversation_get_gc(conv); + yd = gc->proto_data; + id = yd->conf_id; + gaim_debug(GAIM_DEBUG_INFO, "yahoo", + "Trying to join %s \n", args[0]); + + comp = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); + g_hash_table_replace(comp, g_strdup("room"), + g_strdup_printf("%s", g_ascii_strdown(args[0], strlen(args[0])))); + g_hash_table_replace(comp, g_strdup("type"), g_strdup("Chat")); + + yahoo_c_join(gc, comp); + + g_hash_table_destroy(comp); + return GAIM_CMD_RET_OK; +} +/************************** Plugin Initialization ****************************/ +static void +yahoogaim_register_commands(void) +{ + gaim_cmd_register("join", "s", GAIM_CMD_P_PRPL, + GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | + GAIM_CMD_FLAG_PRPL_ONLY, + "prpl-yahoo", yahoogaim_cmd_chat_join, + _("join <room>: Join a chat room on the Yahoo network"), NULL); + gaim_cmd_register("buzz", "", GAIM_CMD_P_PLUGIN, + GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_PRPL_ONLY, + "prpl-yahoo", yahoogaim_cmd_buzz, + _("buzz: Buzz a contact to get their attention"), NULL); +} + static GaimPluginProtocolInfo prpl_info = { OPT_PROTO_MAIL_CHECK | OPT_PROTO_CHAT_TOPIC, @@ -3515,7 +3577,7 @@ #endif my_protocol = plugin; - + yahoogaim_register_commands(); yahoo_init_colorht(); }