cpw.rekkanoryo.yahoo.separate_prpls: 7d62ca41: Moved functions around and made some no ...
rekkanoryo at pidgin.im
rekkanoryo at pidgin.im
Sun Jul 5 20:20:23 EDT 2009
-----------------------------------------------------------------
Revision: 7d62ca418e531d9b728fc259bc4ee302e01ed7c0
Ancestor: a2164ae94b0462dc273820050fd8152ad85637b0
Author: rekkanoryo at pidgin.im
Date: 2009-07-05T23:56:07
Branch: im.pidgin.cpw.rekkanoryo.yahoo.separate_prpls
URL: http://d.pidgin.im/viewmtn/revision/info/7d62ca418e531d9b728fc259bc4ee302e01ed7c0
Modified files:
libpurple/protocols/yahoo/Makefile.am
libpurple/protocols/yahoo/libyahoo.c
libpurple/protocols/yahoo/libyahoojp.c
libpurple/protocols/yahoo/libymsg.c
libpurple/protocols/yahoo/libymsg.h
ChangeLog:
Moved functions around and made some no longer static. All the functions
that are no longer static now have prototypes in libymsg.h. Moved the URI
handling stuff to libyahoo.c since I removed the handling capability from
libyahoojp.c. I still need to find out if Yahoo! JAPAN has its own URI
scheme or not.
-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/Makefile.am 3d8ecc7eb4a7f5201c72c4e7df63ae5c9e9133ee
+++ libpurple/protocols/yahoo/Makefile.am 250d14a249690fd5856c4fe420752b765cfb782b
@@ -29,7 +29,6 @@ libyahoojp_la_LDFLAGS = -module -avoid-v
libyahoo_la_LDFLAGS = -module -avoid-version
libyahoojp_la_LDFLAGS = -module -avoid-version
-libymsg_la_LDFLAGS = -module -avoid-version
if STATIC_YAHOO
============================================================
--- libpurple/protocols/yahoo/libyahoo.c bcd2fa9910c12c802b39abfe6a5b831cde7bfdd7
+++ libpurple/protocols/yahoo/libyahoo.c 7fe680b280da7a4c45209632085911f3fb5ea155
@@ -24,8 +24,140 @@
#include "internal.h"
#include <account.h>
-#include <prpl.h>
+#include <core.h>
+#include "libymsg.h"
+#include "yahoochat.h"
+#include "yahoo_aliases.h"
+#include "yahoo_doodle.h"
+#include "yahoo_filexfer.h"
+#include "yahoo_picture.h"
+
+static PurplePlugin *my_protocol = NULL;
+
+static void yahoo_register_commands(void)
+{
+ purple_cmd_register("join", "s", PURPLE_CMD_P_PRPL,
+ PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
+ PURPLE_CMD_FLAG_PRPL_ONLY,
+ "prpl-yahoo", yahoopurple_cmd_chat_join,
+ _("join <room>: Join a chat room on the Yahoo network"), NULL);
+ purple_cmd_register("list", "", PURPLE_CMD_P_PRPL,
+ PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
+ PURPLE_CMD_FLAG_PRPL_ONLY,
+ "prpl-yahoo", yahoopurple_cmd_chat_list,
+ _("list: List rooms on the Yahoo network"), NULL);
+ purple_cmd_register("buzz", "", PURPLE_CMD_P_PRPL,
+ PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY,
+ "prpl-yahoo", yahoopurple_cmd_buzz,
+ _("buzz: Buzz a user to get their attention"), NULL);
+ purple_cmd_register("doodle", "", PURPLE_CMD_P_PRPL,
+ PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY,
+ "prpl-yahoo", yahoo_doodle_purple_cmd_start,
+ _("doodle: Request user to start a Doodle session"), NULL);
+}
+
+static PurpleAccount *find_acct(const char *prpl, const char *acct_id)
+{
+ PurpleAccount *acct = NULL;
+
+ /* If we have a specific acct, use it */
+ if (acct_id) {
+ acct = purple_accounts_find(acct_id, prpl);
+ if (acct && !purple_account_is_connected(acct))
+ acct = NULL;
+ } else { /* Otherwise find an active account for the protocol */
+ GList *l = purple_accounts_get_all();
+ while (l) {
+ if (!strcmp(prpl, purple_account_get_protocol_id(l->data))
+ && purple_account_is_connected(l->data)) {
+ acct = l->data;
+ break;
+ }
+ l = l->next;
+ }
+ }
+
+ return acct;
+}
+
+/* This may not be the best way to do this, but we find the first key w/o a value
+ * and assume it is the buddy name */
+static void yahoo_find_uri_novalue_param(gpointer key, gpointer value, gpointer user_data)
+{
+ char **retval = user_data;
+
+ if (value == NULL && *retval == NULL) {
+ *retval = key;
+ }
+}
+
+static gboolean yahoo_uri_handler(const char *proto, const char *cmd, GHashTable *params)
+{
+ char *acct_id = g_hash_table_lookup(params, "account");
+ PurpleAccount *acct;
+
+ if (g_ascii_strcasecmp(proto, "ymsgr"))
+ return FALSE;
+
+ acct = find_acct(purple_plugin_get_id(my_protocol), acct_id);
+
+ if (!acct)
+ return FALSE;
+
+ /* ymsgr:SendIM?screename&m=The+Message */
+ if (!g_ascii_strcasecmp(cmd, "SendIM")) {
+ char *sname = NULL;
+ g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &sname);
+ if (sname) {
+ char *message = g_hash_table_lookup(params, "m");
+
+ PurpleConversation *conv = purple_find_conversation_with_account(
+ PURPLE_CONV_TYPE_IM, sname, acct);
+ if (conv == NULL)
+ conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, sname);
+ purple_conversation_present(conv);
+
+ if (message) {
+ /* Spaces are encoded as '+' */
+ g_strdelimit(message, "+", ' ');
+ purple_conv_send_confirm(conv, message);
+ }
+ }
+ /* else
+ **If pidgindialogs_im() was in the core, we could use it here.
+ * It is all purple_request_* based, but I'm not sure it really belongs in the core
+ pidgindialogs_im(); */
+
+ return TRUE;
+ }
+ /* ymsgr:Chat?roomname */
+ else if (!g_ascii_strcasecmp(cmd, "Chat")) {
+ char *rname = NULL;
+ g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &rname);
+ if (rname) {
+ /* This is somewhat hacky, but the params aren't useful after this command */
+ g_hash_table_insert(params, g_strdup("room"), g_strdup(rname));
+ g_hash_table_insert(params, g_strdup("type"), g_strdup("Chat"));
+ serv_join_chat(purple_account_get_connection(acct), params);
+ }
+ /* else
+ ** Same as above (except that this would have to be re-written using purple_request_*)
+ pidgin_blist_joinchat_show(); */
+
+ return TRUE;
+ }
+ /* ymsgr:AddFriend?name */
+ else if (!g_ascii_strcasecmp(cmd, "AddFriend")) {
+ char *name = NULL;
+ g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &name);
+ purple_blist_request_add_buddy(acct, name, NULL, NULL);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static GHashTable *
yahoo_get_account_text_table(PurpleAccount *account)
{
@@ -35,6 +167,13 @@ yahoo_get_account_text_table(PurpleAccou
return table;
}
+static gboolean yahoo_unload_plugin(PurplePlugin *plugin)
+{
+ yahoo_dest_colorht();
+
+ return TRUE;
+}
+
static PurpleWhiteboardPrplOps yahoo_whiteboard_prpl_ops =
{
yahoo_doodle_start,
@@ -201,7 +340,7 @@ init_plugin(PurplePlugin *plugin)
#endif
my_protocol = plugin;
- yahoopurple_register_commands();
+ yahoo_register_commands();
yahoo_init_colorht();
purple_signal_connect(purple_get_core(), "uri-handler", plugin,
============================================================
--- libpurple/protocols/yahoo/libyahoojp.c 304e5382b1e38ed403d62b343260e1bcf375a8f4
+++ libpurple/protocols/yahoo/libyahoojp.c af77b87740a396d884c10d6f9cc91ca1fa8daf0c
@@ -24,8 +24,36 @@
#include "internal.h"
#include <account.h>
-#include <prpl.h>
+#include "libymsg.h"
+#include "yahoochat.h"
+#include "yahoo_aliases.h"
+#include "yahoo_doodle.h"
+#include "yahoo_filexfer.h"
+#include "yahoo_picture.h"
+
+static void yahoojp_register_commands(void)
+{
+ purple_cmd_register("join", "s", PURPLE_CMD_P_PRPL,
+ PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
+ PURPLE_CMD_FLAG_PRPL_ONLY,
+ "prpl-yahoojp", yahoopurple_cmd_chat_join,
+ _("join <room>: Join a chat room on the Yahoo network"), NULL);
+ purple_cmd_register("list", "", PURPLE_CMD_P_PRPL,
+ PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
+ PURPLE_CMD_FLAG_PRPL_ONLY,
+ "prpl-yahoojp", yahoopurple_cmd_chat_list,
+ _("list: List rooms on the Yahoo network"), NULL);
+ purple_cmd_register("buzz", "", PURPLE_CMD_P_PRPL,
+ PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY,
+ "prpl-yahoojp", yahoopurple_cmd_buzz,
+ _("buzz: Buzz a user to get their attention"), NULL);
+ purple_cmd_register("doodle", "", PURPLE_CMD_P_PRPL,
+ PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY,
+ "prpl-yahoojp", yahoo_doodle_purple_cmd_start,
+ _("doodle: Request user to start a Doodle session"), NULL);
+}
+
static GHashTable *
yahoojp_get_account_text_table(PurpleAccount *account)
{
@@ -35,6 +63,13 @@ yahoojp_get_account_text_table(PurpleAcc
return table;
}
+static gboolean yahoojp_unload_plugin(PurplePlugin *plugin)
+{
+ yahoo_dest_colorht();
+
+ return TRUE;
+}
+
static PurpleWhiteboardPrplOps yahoo_whiteboard_prpl_ops =
{
yahoo_doodle_start,
@@ -148,7 +183,7 @@ static PurplePluginInfo info =
NULL, /**< author */
PURPLE_WEBSITE, /**< homepage */
NULL, /**< load */
- yahoo_unload_plugin, /**< unload */
+ yahoojp_unload_plugin, /**< unload */
NULL, /**< destroy */
NULL, /**< ui_info */
&prpl_info, /**< extra_info */
@@ -200,8 +235,7 @@ init_plugin(PurplePlugin *plugin)
prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
#endif
- my_protocol = plugin;
- yahoopurple_register_commands();
+ yahoojp_register_commands();
yahoo_init_colorht();
}
============================================================
--- libpurple/protocols/yahoo/libymsg.c 44468329f7d9fdd4041758b0ded1921a56c852e7
+++ libpurple/protocols/yahoo/libymsg.c c0985fc66755195bb3bdb668904d86243a8774fe
@@ -41,7 +41,7 @@
#include "version.h"
#include "xmlnode.h"
-#include "ymsg.h"
+#include "libymsg.h"
#include "yahoochat.h"
#include "yahoo_aliases.h"
#include "yahoo_doodle.h"
@@ -61,11 +61,9 @@
/* One minute */
#define KEEPALIVE_TIMEOUT 60
-static void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *, PurpleGroup *);
#ifdef TRY_WEBMESSENGER_LOGIN
static void yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message);
#endif /* TRY_WEBMESSENGER_LOGIN */
-static void yahoo_set_status(PurpleAccount *account, PurpleStatus *status);
static void yahoo_update_status(PurpleConnection *gc, const char *name, YahooFriend *f)
{
@@ -3398,7 +3396,7 @@ static int get_yahoo_status_from_purple_
}
}
-static void yahoo_login(PurpleAccount *account) {
+void yahoo_login(PurpleAccount *account) {
PurpleConnection *gc = purple_account_get_connection(account);
struct yahoo_data *yd = gc->proto_data = g_new0(struct yahoo_data, 1);
PurpleStatus *status = purple_account_get_active_status(account);
@@ -3453,7 +3451,7 @@ static void yahoo_login(PurpleAccount *a
}
}
-static void yahoo_close(PurpleConnection *gc) {
+void yahoo_close(PurpleConnection *gc) {
struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
GSList *l;
@@ -3541,12 +3539,12 @@ static void yahoo_close(PurpleConnection
gc->proto_data = NULL;
}
-static const char *yahoo_list_icon(PurpleAccount *a, PurpleBuddy *b)
+const char *yahoo_list_icon(PurpleAccount *a, PurpleBuddy *b)
{
return "yahoo";
}
-static const char *yahoo_list_emblem(PurpleBuddy *b)
+const char *yahoo_list_emblem(PurpleBuddy *b)
{
PurpleAccount *account;
PurpleConnection *gc;
@@ -3680,7 +3678,7 @@ static void yahoo_game(PurpleBlistNode *
g_free(game2);
}
-static char *yahoo_status_text(PurpleBuddy *b)
+char *yahoo_status_text(PurpleBuddy *b)
{
YahooFriend *f = NULL;
const char *msg;
@@ -3910,7 +3908,7 @@ static GList *yahoo_buddy_menu(PurpleBud
return m;
}
-static GList *yahoo_blist_node_menu(PurpleBlistNode *node)
+GList *yahoo_blist_node_menu(PurpleBlistNode *node)
{
if(PURPLE_BLIST_NODE_IS_BUDDY(node)) {
return yahoo_buddy_menu((PurpleBuddy *) node);
@@ -4049,7 +4047,7 @@ static void yahoo_show_chat_goto(PurpleP
gc);
}
-static GList *yahoo_actions(PurplePlugin *plugin, gpointer context) {
+GList *yahoo_actions(PurplePlugin *plugin, gpointer context) {
GList *m = NULL;
PurplePluginAction *act;
@@ -4075,8 +4073,6 @@ struct yahoo_sms_carrier_cb_data {
char *what;
};
-static int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags);
-
static void yahoo_get_sms_carrier_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data,
const gchar *webdata, size_t len, const gchar *error_message)
{
@@ -4189,7 +4185,7 @@ static void yahoo_get_sms_carrier(Purple
}
}
-static int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags)
+int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags)
{
struct yahoo_data *yd = gc->proto_data;
struct yahoo_packet *pkt = NULL;
@@ -4340,7 +4336,7 @@ static int yahoo_send_im(PurpleConnectio
return ret;
}
-static unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state)
+unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state)
{
struct yahoo_data *yd = gc->proto_data;
struct yahoo_p2p_data *p2p_data;
@@ -4383,7 +4379,7 @@ static void yahoo_session_presence_remov
f->presence = YAHOO_PRESENCE_DEFAULT;
}
-static void yahoo_set_status(PurpleAccount *account, PurpleStatus *status)
+void yahoo_set_status(PurpleAccount *account, PurpleStatus *status)
{
PurpleConnection *gc;
PurplePresence *presence;
@@ -4460,7 +4456,7 @@ static void yahoo_set_status(PurpleAccou
}
}
-static void yahoo_set_idle(PurpleConnection *gc, int idle)
+void yahoo_set_idle(PurpleConnection *gc, int idle)
{
struct yahoo_data *yd = gc->proto_data;
struct yahoo_packet *pkt = NULL;
@@ -4508,7 +4504,7 @@ static void yahoo_set_idle(PurpleConnect
g_free(msg2);
}
-static GList *yahoo_status_types(PurpleAccount *account)
+GList *yahoo_status_types(PurpleAccount *account)
{
PurpleStatusType *type;
GList *types = NULL;
@@ -4565,7 +4561,7 @@ static GList *yahoo_status_types(PurpleA
return types;
}
-static void yahoo_keepalive(PurpleConnection *gc)
+void yahoo_keepalive(PurpleConnection *gc)
{
struct yahoo_packet *pkt;
struct yahoo_data *yd = gc->proto_data;
@@ -4599,7 +4595,7 @@ static void yahoo_keepalive(PurpleConnec
}
-static void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g)
+void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g)
{
struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
struct yahoo_packet *pkt;
@@ -4663,7 +4659,7 @@ static void yahoo_add_buddy(PurpleConnec
g_free(group2);
}
-static void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group)
+void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group)
{
struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
struct yahoo_packet *pkt;
@@ -4712,7 +4708,7 @@ static void yahoo_remove_buddy(PurpleCon
g_free(cg);
}
-static void yahoo_add_deny(PurpleConnection *gc, const char *who) {
+void yahoo_add_deny(PurpleConnection *gc, const char *who) {
struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
struct yahoo_packet *pkt;
@@ -4728,7 +4724,7 @@ static void yahoo_add_deny(PurpleConnect
yahoo_packet_send_and_free(pkt, yd);
}
-static void yahoo_rem_deny(PurpleConnection *gc, const char *who) {
+void yahoo_rem_deny(PurpleConnection *gc, const char *who) {
struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
struct yahoo_packet *pkt;
@@ -4743,7 +4739,7 @@ static void yahoo_rem_deny(PurpleConnect
yahoo_packet_send_and_free(pkt, yd);
}
-static void yahoo_set_permit_deny(PurpleConnection *gc)
+void yahoo_set_permit_deny(PurpleConnection *gc)
{
PurpleAccount *account;
GSList *deny;
@@ -4767,14 +4763,7 @@ static void yahoo_set_permit_deny(Purple
}
}
-static gboolean yahoo_unload_plugin(PurplePlugin *plugin)
-{
- yahoo_dest_colorht();
-
- return TRUE;
-}
-
-static void yahoo_change_buddys_group(PurpleConnection *gc, const char *who,
+void yahoo_change_buddys_group(PurpleConnection *gc, const char *who,
const char *old_group, const char *new_group)
{
struct yahoo_data *yd = gc->proto_data;
@@ -4823,7 +4812,7 @@ static void yahoo_change_buddys_group(Pu
g_free(gpo);
}
-static void yahoo_rename_group(PurpleConnection *gc, const char *old_name,
+void yahoo_rename_group(PurpleConnection *gc, const char *old_name,
PurpleGroup *group, GList *moved_buddies)
{
struct yahoo_data *yd = gc->proto_data;
@@ -4848,7 +4837,7 @@ static void yahoo_rename_group(PurpleCon
/********************************* Commands **********************************/
-static PurpleCmdRet
+PurpleCmdRet
yahoopurple_cmd_buzz(PurpleConversation *c, const gchar *cmd, gchar **args, gchar **error, void *data) {
PurpleAccount *account = purple_conversation_get_account(c);
@@ -4860,9 +4849,7 @@ yahoopurple_cmd_buzz(PurpleConversation
return PURPLE_CMD_RET_OK;
}
-static PurplePlugin *my_protocol = NULL;
-
-static PurpleCmdRet
+PurpleCmdRet
yahoopurple_cmd_chat_join(PurpleConversation *conv, const char *cmd,
char **args, char **error, void *data)
{
@@ -4889,7 +4876,7 @@ yahoopurple_cmd_chat_join(PurpleConversa
return PURPLE_CMD_RET_OK;
}
-static PurpleCmdRet
+PurpleCmdRet
yahoopurple_cmd_chat_list(PurpleConversation *conv, const char *cmd,
char **args, char **error, void *data)
{
@@ -4900,7 +4887,7 @@ yahoopurple_cmd_chat_list(PurpleConversa
return PURPLE_CMD_RET_OK;
}
-static gboolean yahoo_offline_message(const PurpleBuddy *buddy)
+gboolean yahoo_offline_message(const PurpleBuddy *buddy)
{
return TRUE;
}
@@ -4935,128 +4922,3 @@ GList *yahoo_attention_types(PurpleAccou
return list;
}
-/************************** Plugin Initialization ****************************/
-static void
-yahoopurple_register_commands(void)
-{
- purple_cmd_register("join", "s", PURPLE_CMD_P_PRPL,
- PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
- PURPLE_CMD_FLAG_PRPL_ONLY,
- "prpl-yahoo", yahoopurple_cmd_chat_join,
- _("join <room>: Join a chat room on the Yahoo network"), NULL);
- purple_cmd_register("list", "", PURPLE_CMD_P_PRPL,
- PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
- PURPLE_CMD_FLAG_PRPL_ONLY,
- "prpl-yahoo", yahoopurple_cmd_chat_list,
- _("list: List rooms on the Yahoo network"), NULL);
- purple_cmd_register("buzz", "", PURPLE_CMD_P_PRPL,
- PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY,
- "prpl-yahoo", yahoopurple_cmd_buzz,
- _("buzz: Buzz a user to get their attention"), NULL);
- purple_cmd_register("doodle", "", PURPLE_CMD_P_PRPL,
- PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY,
- "prpl-yahoo", yahoo_doodle_purple_cmd_start,
- _("doodle: Request user to start a Doodle session"), NULL);
-}
-
-static PurpleAccount *find_acct(const char *prpl, const char *acct_id)
-{
- PurpleAccount *acct = NULL;
-
- /* If we have a specific acct, use it */
- if (acct_id) {
- acct = purple_accounts_find(acct_id, prpl);
- if (acct && !purple_account_is_connected(acct))
- acct = NULL;
- } else { /* Otherwise find an active account for the protocol */
- GList *l = purple_accounts_get_all();
- while (l) {
- if (!strcmp(prpl, purple_account_get_protocol_id(l->data))
- && purple_account_is_connected(l->data)) {
- acct = l->data;
- break;
- }
- l = l->next;
- }
- }
-
- return acct;
-}
-
-/* This may not be the best way to do this, but we find the first key w/o a value
- * and assume it is the buddy name */
-static void yahoo_find_uri_novalue_param(gpointer key, gpointer value, gpointer user_data)
-{
- char **retval = user_data;
-
- if (value == NULL && *retval == NULL) {
- *retval = key;
- }
-}
-
-static gboolean yahoo_uri_handler(const char *proto, const char *cmd, GHashTable *params)
-{
- char *acct_id = g_hash_table_lookup(params, "account");
- PurpleAccount *acct;
-
- if (g_ascii_strcasecmp(proto, "ymsgr"))
- return FALSE;
-
- acct = find_acct(purple_plugin_get_id(my_protocol), acct_id);
-
- if (!acct)
- return FALSE;
-
- /* ymsgr:SendIM?screename&m=The+Message */
- if (!g_ascii_strcasecmp(cmd, "SendIM")) {
- char *sname = NULL;
- g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &sname);
- if (sname) {
- char *message = g_hash_table_lookup(params, "m");
-
- PurpleConversation *conv = purple_find_conversation_with_account(
- PURPLE_CONV_TYPE_IM, sname, acct);
- if (conv == NULL)
- conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, sname);
- purple_conversation_present(conv);
-
- if (message) {
- /* Spaces are encoded as '+' */
- g_strdelimit(message, "+", ' ');
- purple_conv_send_confirm(conv, message);
- }
- }
- /* else
- **If pidgindialogs_im() was in the core, we could use it here.
- * It is all purple_request_* based, but I'm not sure it really belongs in the core
- pidgindialogs_im(); */
-
- return TRUE;
- }
- /* ymsgr:Chat?roomname */
- else if (!g_ascii_strcasecmp(cmd, "Chat")) {
- char *rname = NULL;
- g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &rname);
- if (rname) {
- /* This is somewhat hacky, but the params aren't useful after this command */
- g_hash_table_insert(params, g_strdup("room"), g_strdup(rname));
- g_hash_table_insert(params, g_strdup("type"), g_strdup("Chat"));
- serv_join_chat(purple_account_get_connection(acct), params);
- }
- /* else
- ** Same as above (except that this would have to be re-written using purple_request_*)
- pidgin_blist_joinchat_show(); */
-
- return TRUE;
- }
- /* ymsgr:AddFriend?name */
- else if (!g_ascii_strcasecmp(cmd, "AddFriend")) {
- char *name = NULL;
- g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &name);
- purple_blist_request_add_buddy(acct, name, NULL, NULL);
- return TRUE;
- }
-
- return FALSE;
-}
-
============================================================
--- libpurple/protocols/yahoo/libymsg.h 53e8b3fd0f2194b1154e57a49a26083aa08f9c87
+++ libpurple/protocols/yahoo/libymsg.h 571540c0f32899c58e33bb64bf6bbc0ce1872f64
@@ -22,10 +22,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
-#ifndef _YAHOO_H_
-#define _YAHOO_H_
+#ifndef _LIBYMSG_H_
+#define _LIBYMSG_H_
#include "circbuffer.h"
+#include "cmds.h"
#include "prpl.h"
#define YAHOO_PAGER_HOST "scsa.msg.yahoo.com"
@@ -289,22 +290,49 @@ char *yahoo_convert_to_numeric(const cha
char *yahoo_convert_to_numeric(const char *str);
-/* previously-static functions, now needed for yahoo_profile.c */
-void yahoo_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full);
/* yahoo_profile.c */
void yahoo_get_info(PurpleConnection *gc, const char *name);
+/* libymsg.h - these functions were formerly static but need not to be for the
+ * new two-prpl model. */
+const char *yahoo_list_icon(PurpleAccount *a, PurpleBuddy *b);
+const char *yahoo_list_emblem(PurpleBuddy *b);
+char *yahoo_status_text(PurpleBuddy *b);
+void yahoo_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full);
+GList *yahoo_status_types(PurpleAccount *account);
+GList *yahoo_blist_node_menu(PurpleBlistNode *node);
+void yahoo_login(PurpleAccount *account);
+void yahoo_close(PurpleConnection *gc);
+int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags);
+unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state);
+void yahoo_set_status(PurpleAccount *account, PurpleStatus *status);
+void yahoo_set_idle(PurpleConnection *gc, int idle);
+void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g);
+void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group);
+void yahoo_add_deny(PurpleConnection *gc, const char *who);
+void yahoo_rem_deny(PurpleConnection *gc, const char *who);
+void yahoo_set_permit_deny(PurpleConnection *gc);
+void yahoo_keepalive(PurpleConnection *gc);
+void yahoo_change_buddys_group(PurpleConnection *gc, const char *who, const char *old_group, const char *new_group);
+void yahoo_rename_group(PurpleConnection *gc, const char *old_name, PurpleGroup *group, GList *moved_buddies);
+gboolean yahoo_offline_message(const PurpleBuddy *buddy);
+gboolean yahoo_send_attention(PurpleConnection *gc, const char *username, guint type);
+GList *yahoo_attention_types(PurpleAccount *account);
+
+GList *yahoo_actions(PurplePlugin *plugin, gpointer context);
+void yahoopurple_register_commands(void);
+
+PurpleCmdRet yahoopurple_cmd_buzz(PurpleConversation *c, const gchar *cmd, gchar **args, gchar **error, void *data);
+PurpleCmdRet yahoopurple_cmd_chat_join(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data);
+PurpleCmdRet yahoopurple_cmd_chat_list(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data);
/* needed for xfer, thought theyd be useful for other enhancements later on
Returns list of cookies stored in yahoo_data formatted as a single null terminated string
returned value must be g_freed
*/
gchar* yahoo_get_cookies(PurpleConnection *gc);
-gboolean yahoo_send_attention(PurpleConnection *gc, const char *username, guint type);
-GList *yahoo_attention_types(PurpleAccount *account);
-
/* send p2p pkt containing our encoded ip, asking peer to connect to us */
void yahoo_send_p2p_pkt(PurpleConnection *gc, const char *who, int val_13);
-#endif /* _YAHOO_H_ */
+#endif /* _LIBYMSG_H_ */
More information about the Commits
mailing list