libpurple/protocols/yahoo/yahoo.c

Wed, 04 Sep 2013 20:08:58 +0530

author
Ankit Vani <a@nevitus.org>
date
Wed, 04 Sep 2013 20:08:58 +0530
branch
soc.2013.gobjectification.plugins
changeset 36684
ecc74498e088
parent 36678
ed9d10d8e45a
child 36714
ec178f7d66da
permissions
-rw-r--r--

Refactored other protocols to use instance init

27556
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
1 /*
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
2 * purple
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
3 *
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
4 * Purple is the legal property of its developers, whose names are too numerous
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
6 * source distribution.
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
7 *
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
11 * (at your option) any later version.
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
12 *
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
16 * GNU General Public License for more details.
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
17 *
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
21 *
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
22 */
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
23
27559
3007dde24778 Add header includes. I still have not yet tested building this.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27557
diff changeset
24 #include "internal.h"
3007dde24778 Add header includes. I still have not yet tested building this.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27557
diff changeset
25
3007dde24778 Add header includes. I still have not yet tested building this.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27557
diff changeset
26 #include <account.h>
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
27 #include <core.h>
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
28 #include <plugins.h>
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
29
36670
418f1f8581de Add/remove YahooProtocol, YahooJPProtocol via the single yahoo plugin
Ankit Vani <a@nevitus.org>
parents: 36667
diff changeset
30 #include "ymsg.h"
36667
bfdad85c76e6 Build a single library for jabber.
Ankit Vani <a@nevitus.org>
parents: 36663
diff changeset
31 #include "yahoo.h"
36670
418f1f8581de Add/remove YahooProtocol, YahooJPProtocol via the single yahoo plugin
Ankit Vani <a@nevitus.org>
parents: 36667
diff changeset
32 #include "yahoojp.h"
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
33 #include "yahoochat.h"
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
34 #include "yahoo_aliases.h"
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
35 #include "yahoo_doodle.h"
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
36 #include "yahoo_filexfer.h"
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
37 #include "yahoo_picture.h"
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
38
36670
418f1f8581de Add/remove YahooProtocol, YahooJPProtocol via the single yahoo plugin
Ankit Vani <a@nevitus.org>
parents: 36667
diff changeset
39 PurplePlugin *_yahoo_plugin;
418f1f8581de Add/remove YahooProtocol, YahooJPProtocol via the single yahoo plugin
Ankit Vani <a@nevitus.org>
parents: 36667
diff changeset
40
418f1f8581de Add/remove YahooProtocol, YahooJPProtocol via the single yahoo plugin
Ankit Vani <a@nevitus.org>
parents: 36667
diff changeset
41 static PurpleProtocol *yahoo_protocol = NULL;
418f1f8581de Add/remove YahooProtocol, YahooJPProtocol via the single yahoo plugin
Ankit Vani <a@nevitus.org>
parents: 36667
diff changeset
42 static PurpleProtocol *yahoojp_protocol = NULL;
418f1f8581de Add/remove YahooProtocol, YahooJPProtocol via the single yahoo plugin
Ankit Vani <a@nevitus.org>
parents: 36667
diff changeset
43
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36653
diff changeset
44 static GSList *cmds = NULL;
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
45
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
46 static void yahoo_register_commands(void)
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
47 {
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36653
diff changeset
48 PurpleCmdId id;
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36653
diff changeset
49
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36653
diff changeset
50 id = purple_cmd_register("join", "s", PURPLE_CMD_P_PROTOCOL,
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
51 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
52 PURPLE_CMD_FLAG_PROTOCOL_ONLY,
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36628
diff changeset
53 "yahoo", yahoopurple_cmd_chat_join,
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
54 _("join &lt;room&gt;: Join a chat room on the Yahoo network"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36653
diff changeset
55 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36653
diff changeset
56
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36653
diff changeset
57 id = purple_cmd_register("list", "", PURPLE_CMD_P_PROTOCOL,
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
58 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
59 PURPLE_CMD_FLAG_PROTOCOL_ONLY,
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36628
diff changeset
60 "yahoo", yahoopurple_cmd_chat_list,
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
61 _("list: List rooms on the Yahoo network"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36653
diff changeset
62 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36653
diff changeset
63
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36653
diff changeset
64 id = purple_cmd_register("buzz", "", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
65 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PROTOCOL_ONLY,
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36628
diff changeset
66 "yahoo", yahoopurple_cmd_buzz,
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
67 _("buzz: Buzz a user to get their attention"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36653
diff changeset
68 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36653
diff changeset
69
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36653
diff changeset
70 id = purple_cmd_register("doodle", "", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
71 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PROTOCOL_ONLY,
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36628
diff changeset
72 "yahoo", yahoo_doodle_purple_cmd_start,
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
73 _("doodle: Request user to start a Doodle session"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36653
diff changeset
74 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36653
diff changeset
75 }
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36653
diff changeset
76
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36653
diff changeset
77 static void yahoo_unregister_commands(void)
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36653
diff changeset
78 {
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36653
diff changeset
79 while (cmds) {
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36653
diff changeset
80 PurpleCmdId id = GPOINTER_TO_UINT(cmds->data);
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36653
diff changeset
81 purple_cmd_unregister(id);
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36653
diff changeset
82 cmds = g_slist_delete_link(cmds, cmds);
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36653
diff changeset
83 }
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
84 }
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
85
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36628
diff changeset
86 static PurpleAccount *find_acct(const char *protocol, const char *acct_id)
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
87 {
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
88 PurpleAccount *acct = NULL;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
89
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
90 /* If we have a specific acct, use it */
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
91 if (acct_id) {
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36628
diff changeset
92 acct = purple_accounts_find(acct_id, protocol);
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
93 if (acct && !purple_account_is_connected(acct))
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
94 acct = NULL;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
95 } else { /* Otherwise find an active account for the protocol */
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
96 GList *l = purple_accounts_get_all();
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
97 while (l) {
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36628
diff changeset
98 if (!strcmp(protocol, purple_account_get_protocol_id(l->data))
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
99 && purple_account_is_connected(l->data)) {
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
100 acct = l->data;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
101 break;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
102 }
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
103 l = l->next;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
104 }
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
105 }
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
106
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
107 return acct;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
108 }
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
109
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
110 /* This may not be the best way to do this, but we find the first key w/o a value
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
111 * and assume it is the buddy name */
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
112 static void yahoo_find_uri_novalue_param(gpointer key, gpointer value, gpointer user_data)
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
113 {
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
114 char **retval = user_data;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
115
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
116 if (value == NULL && *retval == NULL) {
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
117 *retval = key;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
118 }
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
119 }
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
120
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
121 static gboolean yahoo_uri_handler(const char *proto, const char *cmd, GHashTable *params)
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
122 {
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
123 char *acct_id = g_hash_table_lookup(params, "account");
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
124 PurpleAccount *acct;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
125
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
126 if (g_ascii_strcasecmp(proto, "ymsgr"))
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
127 return FALSE;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
128
36670
418f1f8581de Add/remove YahooProtocol, YahooJPProtocol via the single yahoo plugin
Ankit Vani <a@nevitus.org>
parents: 36667
diff changeset
129 acct = find_acct(purple_protocol_get_id(yahoo_protocol), acct_id);
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
130
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
131 if (!acct)
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
132 return FALSE;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
133
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
134 /* ymsgr:SendIM?screename&m=The+Message */
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
135 if (!g_ascii_strcasecmp(cmd, "SendIM")) {
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
136 char *sname = NULL;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
137 g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &sname);
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
138 if (sname) {
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
139 char *message = g_hash_table_lookup(params, "m");
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
140
34642
5ef8e33e5bed Refactored sametime and yahoo protocols to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34635
diff changeset
141 PurpleIMConversation *im = purple_conversations_find_im_with_account(
5ef8e33e5bed Refactored sametime and yahoo protocols to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34635
diff changeset
142 sname, acct);
5ef8e33e5bed Refactored sametime and yahoo protocols to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34635
diff changeset
143 if (im == NULL)
5ef8e33e5bed Refactored sametime and yahoo protocols to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34635
diff changeset
144 im = purple_im_conversation_new(acct, sname);
5ef8e33e5bed Refactored sametime and yahoo protocols to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34635
diff changeset
145 purple_conversation_present(PURPLE_CONVERSATION(im));
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
146
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
147 if (message) {
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
148 /* Spaces are encoded as '+' */
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
149 g_strdelimit(message, "+", ' ');
34642
5ef8e33e5bed Refactored sametime and yahoo protocols to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34635
diff changeset
150 purple_conversation_send_confirm(PURPLE_CONVERSATION(im), message);
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
151 }
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
152 }
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
153 /* else
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
154 **If pidgindialogs_im() was in the core, we could use it here.
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
155 * It is all purple_request_* based, but I'm not sure it really belongs in the core
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
156 pidgindialogs_im(); */
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
157
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
158 return TRUE;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
159 }
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
160 /* ymsgr:Chat?roomname */
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
161 else if (!g_ascii_strcasecmp(cmd, "Chat")) {
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
162 char *rname = NULL;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
163 g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &rname);
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
164 if (rname) {
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
165 /* This is somewhat hacky, but the params aren't useful after this command */
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
166 g_hash_table_insert(params, g_strdup("room"), g_strdup(rname));
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
167 g_hash_table_insert(params, g_strdup("type"), g_strdup("Chat"));
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
168 serv_join_chat(purple_account_get_connection(acct), params);
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
169 }
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
170 /* else
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
171 ** Same as above (except that this would have to be re-written using purple_request_*)
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
172 pidgin_blist_joinchat_show(); */
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
173
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
174 return TRUE;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
175 }
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
176 /* ymsgr:AddFriend?name */
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
177 else if (!g_ascii_strcasecmp(cmd, "AddFriend")) {
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
178 char *name = NULL;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
179 g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &name);
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
180 purple_blist_request_add_buddy(acct, name, NULL, NULL);
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
181 return TRUE;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
182 }
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
183
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
184 return FALSE;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
185 }
27559
3007dde24778 Add header includes. I still have not yet tested building this.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27557
diff changeset
186
27557
08a8cbc0a0ec have a separate hash table function for each prpl.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27556
diff changeset
187 static GHashTable *
08a8cbc0a0ec have a separate hash table function for each prpl.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27556
diff changeset
188 yahoo_get_account_text_table(PurpleAccount *account)
08a8cbc0a0ec have a separate hash table function for each prpl.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27556
diff changeset
189 {
08a8cbc0a0ec have a separate hash table function for each prpl.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27556
diff changeset
190 GHashTable *table;
08a8cbc0a0ec have a separate hash table function for each prpl.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27556
diff changeset
191 table = g_hash_table_new(g_str_hash, g_str_equal);
08a8cbc0a0ec have a separate hash table function for each prpl.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27556
diff changeset
192 g_hash_table_insert(table, "login_label", (gpointer)_("Yahoo ID..."));
08a8cbc0a0ec have a separate hash table function for each prpl.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27556
diff changeset
193 return table;
08a8cbc0a0ec have a separate hash table function for each prpl.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27556
diff changeset
194 }
08a8cbc0a0ec have a separate hash table function for each prpl.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27556
diff changeset
195
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36628
diff changeset
196 static PurpleWhiteboardOps yahoo_whiteboard_ops =
27556
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
197 {
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
198 yahoo_doodle_start,
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
199 yahoo_doodle_end,
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
200 yahoo_doodle_get_dimensions,
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
201 NULL,
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
202 yahoo_doodle_get_brush,
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
203 yahoo_doodle_set_brush,
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
204 yahoo_doodle_send_draw_list,
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
205 yahoo_doodle_clear,
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
206
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
207 /* padding */
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
208 NULL,
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
209 NULL,
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
210 NULL,
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
211 NULL
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
212 };
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
213
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
214 static void
36684
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
215 yahoo_protocol_init(PurpleProtocol *protocol)
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
216 {
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
217 PurpleAccountOption *option;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
218
36684
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
219 protocol->id = "yahoo";
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
220 protocol->name = "Yahoo";
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
221 protocol->options = OPT_PROTO_MAIL_CHECK | OPT_PROTO_CHAT_TOPIC |
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
222 OPT_PROTO_AUTHORIZATION_DENIED_MESSAGE;
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
223 protocol->icon_spec = purple_buddy_icon_spec_new("png,gif,jpeg",
36609
637155f87448 Refactored the protocols to use purple_buddy_icon_spec_new()
Ankit Vani <a@nevitus.org>
parents: 36598
diff changeset
224 96, 96, 96, 96, 0,
637155f87448 Refactored the protocols to use purple_buddy_icon_spec_new()
Ankit Vani <a@nevitus.org>
parents: 36598
diff changeset
225 PURPLE_ICON_SCALE_SEND);
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
226
36684
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
227 protocol->whiteboard_ops = &yahoo_whiteboard_ops;
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
228
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
229 option = purple_account_option_int_new(_("Pager port"), "port", YAHOO_PAGER_PORT);
36684
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
230 protocol->protocol_options = g_list_append(protocol->protocol_options, option);
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
231
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
232 option = purple_account_option_string_new(_("File transfer server"), "xfer_host", YAHOO_XFER_HOST);
36684
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
233 protocol->protocol_options = g_list_append(protocol->protocol_options, option);
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
234
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
235 option = purple_account_option_string_new(_("Chat room locale"), "room_list_locale", YAHOO_ROOMLIST_LOCALE);
36684
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
236 protocol->protocol_options = g_list_append(protocol->protocol_options, option);
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
237
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
238 option = purple_account_option_string_new(_("Encoding"), "local_charset", "UTF-8");
36684
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
239 protocol->protocol_options = g_list_append(protocol->protocol_options, option);
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
240
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
241 option = purple_account_option_bool_new(_("Ignore conference and chatroom invitations"), "ignore_invites", FALSE);
36684
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
242 protocol->protocol_options = g_list_append(protocol->protocol_options, option);
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
243
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
244 #if 0
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
245 option = purple_account_option_bool_new(_("Use account proxy for HTTP and HTTPS connections"), "proxy_ssl", FALSE);
36684
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
246 protocol->protocol_options = g_list_append(protocol->protocol_options, option);
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
247
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
248 option = purple_account_option_string_new(_("Chat room list URL"), "room_list", YAHOO_ROOMLIST_URL);
36684
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
249 protocol->protocol_options = g_list_append(protocol->protocol_options, option);
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
250 #endif
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
251 }
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
252
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
253 static void
36684
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
254 yahoo_protocol_class_init(PurpleProtocolClass *klass)
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
255 {
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
256 }
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
257
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
258 static void
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
259 yahoo_protocol_interface_init(PurpleProtocolInterface *iface)
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
260 {
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
261 iface->get_actions = yahoo_get_actions;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
262 iface->list_icon = yahoo_list_icon;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
263 iface->list_emblem = yahoo_list_emblem;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
264 iface->status_text = yahoo_status_text;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
265 iface->tooltip_text = yahoo_tooltip_text;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
266 iface->status_types = yahoo_status_types;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
267 iface->blist_node_menu = yahoo_blist_node_menu;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
268 iface->chat_info = yahoo_c_info;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
269 iface->chat_info_defaults = yahoo_c_info_defaults;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
270 iface->login = yahoo_login;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
271 iface->close = yahoo_close;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
272 iface->send_im = yahoo_send_im;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
273 iface->send_typing = yahoo_send_typing;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
274 iface->get_info = yahoo_get_info;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
275 iface->set_status = yahoo_set_status;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
276 iface->set_idle = yahoo_set_idle;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
277 iface->add_buddy = yahoo_add_buddy;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
278 iface->remove_buddy = yahoo_remove_buddy;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
279 iface->add_deny = yahoo_add_deny;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
280 iface->rem_deny = yahoo_rem_deny;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
281 iface->set_permit_deny = yahoo_set_permit_deny;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
282 iface->join_chat = yahoo_c_join;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
283 iface->get_chat_name = yahoo_get_chat_name;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
284 iface->chat_invite = yahoo_c_invite;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
285 iface->chat_leave = yahoo_c_leave;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
286 iface->chat_send = yahoo_c_send;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
287 iface->keepalive = yahoo_keepalive;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
288 iface->alias_buddy = yahoo_update_alias;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
289 iface->group_buddy = yahoo_change_buddys_group;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
290 iface->rename_group = yahoo_rename_group;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
291 iface->normalize = purple_normalize_nocase;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
292 iface->set_buddy_icon = yahoo_set_buddy_icon;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
293 iface->roomlist_get_list = yahoo_roomlist_get_list;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
294 iface->roomlist_cancel = yahoo_roomlist_cancel;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
295 iface->roomlist_expand_category = yahoo_roomlist_expand_category;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
296 iface->can_receive_file = yahoo_can_receive_file;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
297 iface->send_file = yahoo_send_file;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
298 iface->new_xfer = yahoo_new_xfer;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
299 iface->offline_message = yahoo_offline_message;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
300 iface->send_attention = yahoo_send_attention;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
301 iface->get_attention_types = yahoo_attention_types;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
302 iface->get_account_text_table = yahoo_get_account_text_table;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
303 iface->get_max_message_size = yahoo_get_max_message_size;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
304 }
27556
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
305
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
306 static PurplePluginInfo *
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
307 plugin_query(GError **error)
27556
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
308 {
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
309 return purple_plugin_info_new(
36638
5f6dcd83e8c1 Seperate plugin and protocol IDs. Protocol ID example: "msn". Plugin ID example: "protocol-msn".
Ankit Vani <a@nevitus.org>
parents: 36637
diff changeset
310 "id", "protocol-yahoo",
36670
418f1f8581de Add/remove YahooProtocol, YahooJPProtocol via the single yahoo plugin
Ankit Vani <a@nevitus.org>
parents: 36667
diff changeset
311 "name", "Yahoo Protocols",
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
312 "version", DISPLAY_VERSION,
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
313 "category", N_("Protocol"),
36670
418f1f8581de Add/remove YahooProtocol, YahooJPProtocol via the single yahoo plugin
Ankit Vani <a@nevitus.org>
parents: 36667
diff changeset
314 "summary", N_("Yahoo! and Yahoo! JAPAN Protocols Plugin"),
418f1f8581de Add/remove YahooProtocol, YahooJPProtocol via the single yahoo plugin
Ankit Vani <a@nevitus.org>
parents: 36667
diff changeset
315 "description", N_("Yahoo! and Yahoo! JAPAN Protocols Plugin"),
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
316 "website", PURPLE_WEBSITE,
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
317 "abi-version", PURPLE_ABI_VERSION,
36653
4084c34c051d Override gplugin info's "flags" property. Added PURPLE_PLUGIN_INFO_FLAGS_INTERNAL and PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD.
Ankit Vani <a@nevitus.org>
parents: 36638
diff changeset
318 "flags", PURPLE_PLUGIN_INFO_FLAGS_INTERNAL |
4084c34c051d Override gplugin info's "flags" property. Added PURPLE_PLUGIN_INFO_FLAGS_INTERNAL and PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD.
Ankit Vani <a@nevitus.org>
parents: 36638
diff changeset
319 PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD,
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
320 NULL
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
321 );
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
322 }
27556
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
323
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
324 static gboolean
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
325 plugin_load(PurplePlugin *plugin, GError **error)
27556
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
326 {
36670
418f1f8581de Add/remove YahooProtocol, YahooJPProtocol via the single yahoo plugin
Ankit Vani <a@nevitus.org>
parents: 36667
diff changeset
327 yahoo_protocol = purple_protocols_add(YAHOO_TYPE_PROTOCOL, error);
418f1f8581de Add/remove YahooProtocol, YahooJPProtocol via the single yahoo plugin
Ankit Vani <a@nevitus.org>
parents: 36667
diff changeset
328 if (!yahoo_protocol)
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
329 return FALSE;
28326
6f1bc0dcabdc Add a boolean account option (defaulting to off) to control whether to use
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28198
diff changeset
330
36670
418f1f8581de Add/remove YahooProtocol, YahooJPProtocol via the single yahoo plugin
Ankit Vani <a@nevitus.org>
parents: 36667
diff changeset
331 yahoojp_protocol = purple_protocols_add(YAHOOJP_TYPE_PROTOCOL, error);
418f1f8581de Add/remove YahooProtocol, YahooJPProtocol via the single yahoo plugin
Ankit Vani <a@nevitus.org>
parents: 36667
diff changeset
332 if (!yahoojp_protocol)
418f1f8581de Add/remove YahooProtocol, YahooJPProtocol via the single yahoo plugin
Ankit Vani <a@nevitus.org>
parents: 36667
diff changeset
333 return FALSE;
418f1f8581de Add/remove YahooProtocol, YahooJPProtocol via the single yahoo plugin
Ankit Vani <a@nevitus.org>
parents: 36667
diff changeset
334
36674
37c56498c80f Register and unregister yahoo commands in plugin load/unload
Ankit Vani <a@nevitus.org>
parents: 36670
diff changeset
335 yahoo_init_colorht();
37c56498c80f Register and unregister yahoo commands in plugin load/unload
Ankit Vani <a@nevitus.org>
parents: 36670
diff changeset
336
37c56498c80f Register and unregister yahoo commands in plugin load/unload
Ankit Vani <a@nevitus.org>
parents: 36670
diff changeset
337 yahoo_register_commands();
37c56498c80f Register and unregister yahoo commands in plugin load/unload
Ankit Vani <a@nevitus.org>
parents: 36670
diff changeset
338 yahoojp_register_commands();
37c56498c80f Register and unregister yahoo commands in plugin load/unload
Ankit Vani <a@nevitus.org>
parents: 36670
diff changeset
339
36670
418f1f8581de Add/remove YahooProtocol, YahooJPProtocol via the single yahoo plugin
Ankit Vani <a@nevitus.org>
parents: 36667
diff changeset
340 purple_signal_connect(purple_get_core(), "uri-handler", yahoo_protocol,
27556
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
341 PURPLE_CALLBACK(yahoo_uri_handler), NULL);
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
342
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
343 return TRUE;
27556
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
344 }
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
345
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
346 static gboolean
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
347 plugin_unload(PurplePlugin *plugin, GError **error)
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
348 {
36674
37c56498c80f Register and unregister yahoo commands in plugin load/unload
Ankit Vani <a@nevitus.org>
parents: 36670
diff changeset
349 yahoojp_unregister_commands();
37c56498c80f Register and unregister yahoo commands in plugin load/unload
Ankit Vani <a@nevitus.org>
parents: 36670
diff changeset
350 yahoo_unregister_commands();
37c56498c80f Register and unregister yahoo commands in plugin load/unload
Ankit Vani <a@nevitus.org>
parents: 36670
diff changeset
351
37c56498c80f Register and unregister yahoo commands in plugin load/unload
Ankit Vani <a@nevitus.org>
parents: 36670
diff changeset
352 yahoo_dest_colorht();
37c56498c80f Register and unregister yahoo commands in plugin load/unload
Ankit Vani <a@nevitus.org>
parents: 36670
diff changeset
353
36670
418f1f8581de Add/remove YahooProtocol, YahooJPProtocol via the single yahoo plugin
Ankit Vani <a@nevitus.org>
parents: 36667
diff changeset
354 if (!purple_protocols_remove(yahoojp_protocol, error))
418f1f8581de Add/remove YahooProtocol, YahooJPProtocol via the single yahoo plugin
Ankit Vani <a@nevitus.org>
parents: 36667
diff changeset
355 return FALSE;
418f1f8581de Add/remove YahooProtocol, YahooJPProtocol via the single yahoo plugin
Ankit Vani <a@nevitus.org>
parents: 36667
diff changeset
356
418f1f8581de Add/remove YahooProtocol, YahooJPProtocol via the single yahoo plugin
Ankit Vani <a@nevitus.org>
parents: 36667
diff changeset
357 if (!purple_protocols_remove(yahoo_protocol, error))
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
358 return FALSE;
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
359
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
360 return TRUE;
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
361 }
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
362
36670
418f1f8581de Add/remove YahooProtocol, YahooJPProtocol via the single yahoo plugin
Ankit Vani <a@nevitus.org>
parents: 36667
diff changeset
363 PURPLE_PROTOCOL_DEFINE(_yahoo_plugin, YahooProtocol, yahoo_protocol);
418f1f8581de Add/remove YahooProtocol, YahooJPProtocol via the single yahoo plugin
Ankit Vani <a@nevitus.org>
parents: 36667
diff changeset
364 PURPLE_PLUGIN_INIT_VAL(_yahoo_plugin, yahoo, plugin_query, plugin_load,
36613
0e96218aa13a Refactored the protocols to use the new macros, to allow for static or dynamic loading of types as configured
Ankit Vani <a@nevitus.org>
parents: 36609
diff changeset
365 plugin_unload);

mercurial