Mercurial > pidgin
comparison src/protocols/yahoo/yahoo.c @ 10119:2a2cd2a6f7cf
[gaim-migrate @ 11156]
bleeter added /join and /buzz commands for yahoo.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Tue, 19 Oct 2004 01:46:20 +0000 |
parents | e94f5975a4df |
children | bde7418a2573 |
comparison
equal
deleted
inserted
replaced
10118:ab8e8069b71e | 10119:2a2cd2a6f7cf |
---|---|
24 #include "internal.h" | 24 #include "internal.h" |
25 | 25 |
26 #include "account.h" | 26 #include "account.h" |
27 #include "accountopt.h" | 27 #include "accountopt.h" |
28 #include "blist.h" | 28 #include "blist.h" |
29 #include "cmds.h" | |
29 #include "debug.h" | 30 #include "debug.h" |
30 #include "notify.h" | 31 #include "notify.h" |
31 #include "privacy.h" | 32 #include "privacy.h" |
32 #include "prpl.h" | 33 #include "prpl.h" |
33 #include "proxy.h" | 34 #include "proxy.h" |
3381 yahoo_packet_free(pkt); | 3382 yahoo_packet_free(pkt); |
3382 g_free(gpn); | 3383 g_free(gpn); |
3383 g_free(gpo); | 3384 g_free(gpo); |
3384 } | 3385 } |
3385 | 3386 |
3387 static GaimCmdRet | |
3388 yahoogaim_cmd_buzz(GaimConversation *c, const gchar *cmd, gchar **args, gchar **error, void *data) { | |
3389 | |
3390 GaimAccount *account = gaim_conversation_get_account(c); | |
3391 const char *username = gaim_account_get_username(account); | |
3392 | |
3393 if (*args && args[0]) | |
3394 return GAIM_CMD_RET_FAILED; | |
3395 | |
3396 gaim_debug(GAIM_DEBUG_INFO, "yahoo", | |
3397 "Sending <ding> on account %s to buddy %s.\n", username, c->name); | |
3398 gaim_conv_im_send(GAIM_CONV_IM(c), "<ding>"); | |
3399 gaim_conv_im_write(GAIM_CONV_IM(c), "", _("Buzz!!"), GAIM_MESSAGE_NICK|GAIM_MESSAGE_RECV, time(NULL)); | |
3400 return GAIM_CMD_RET_OK; | |
3401 } | |
3402 | |
3386 static GaimPlugin *my_protocol = NULL; | 3403 static GaimPlugin *my_protocol = NULL; |
3404 | |
3405 /********************************* Commands **********************************/ | |
3406 | |
3407 static GaimCmdRet | |
3408 yahoogaim_cmd_chat_join(GaimConversation *conv, const char *cmd, | |
3409 char **args, char **error, void *data) | |
3410 { | |
3411 GHashTable *comp; | |
3412 GaimConnection *gc; | |
3413 struct yahoo_data *yd; | |
3414 int id; | |
3415 | |
3416 if (!args || !args[0]) | |
3417 return GAIM_CMD_RET_FAILED; | |
3418 | |
3419 gc = gaim_conversation_get_gc(conv); | |
3420 yd = gc->proto_data; | |
3421 id = yd->conf_id; | |
3422 gaim_debug(GAIM_DEBUG_INFO, "yahoo", | |
3423 "Trying to join %s \n", args[0]); | |
3424 | |
3425 comp = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); | |
3426 g_hash_table_replace(comp, g_strdup("room"), | |
3427 g_strdup_printf("%s", g_ascii_strdown(args[0], strlen(args[0])))); | |
3428 g_hash_table_replace(comp, g_strdup("type"), g_strdup("Chat")); | |
3429 | |
3430 yahoo_c_join(gc, comp); | |
3431 | |
3432 g_hash_table_destroy(comp); | |
3433 return GAIM_CMD_RET_OK; | |
3434 } | |
3435 /************************** Plugin Initialization ****************************/ | |
3436 static void | |
3437 yahoogaim_register_commands(void) | |
3438 { | |
3439 gaim_cmd_register("join", "s", GAIM_CMD_P_PRPL, | |
3440 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | | |
3441 GAIM_CMD_FLAG_PRPL_ONLY, | |
3442 "prpl-yahoo", yahoogaim_cmd_chat_join, | |
3443 _("join <room>: Join a chat room on the Yahoo network"), NULL); | |
3444 gaim_cmd_register("buzz", "", GAIM_CMD_P_PLUGIN, | |
3445 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_PRPL_ONLY, | |
3446 "prpl-yahoo", yahoogaim_cmd_buzz, | |
3447 _("buzz: Buzz a contact to get their attention"), NULL); | |
3448 } | |
3387 | 3449 |
3388 static GaimPluginProtocolInfo prpl_info = | 3450 static GaimPluginProtocolInfo prpl_info = |
3389 { | 3451 { |
3390 OPT_PROTO_MAIL_CHECK | OPT_PROTO_CHAT_TOPIC, | 3452 OPT_PROTO_MAIL_CHECK | OPT_PROTO_CHAT_TOPIC, |
3391 NULL, /* user_splits */ | 3453 NULL, /* user_splits */ |
3513 option = gaim_account_option_int_new(_("YCHT Port"), "ycht-port", YAHOO_YCHT_PORT); | 3575 option = gaim_account_option_int_new(_("YCHT Port"), "ycht-port", YAHOO_YCHT_PORT); |
3514 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); | 3576 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
3515 #endif | 3577 #endif |
3516 | 3578 |
3517 my_protocol = plugin; | 3579 my_protocol = plugin; |
3518 | 3580 yahoogaim_register_commands(); |
3519 yahoo_init_colorht(); | 3581 yahoo_init_colorht(); |
3520 } | 3582 } |
3521 | 3583 |
3522 GAIM_INIT_PLUGIN(yahoo, init_plugin, info); | 3584 GAIM_INIT_PLUGIN(yahoo, init_plugin, info); |