libpurple/protocols/yahoo/libyahoo.c

Sun, 01 Sep 2013 14:24:24 +0530

author
Ankit Vani <a@nevitus.org>
date
Sun, 01 Sep 2013 14:24:24 +0530
branch
soc.2013.gobjectification.plugins
changeset 36637
9b0109ae118d
parent 36628
3d43ca8d69ee
child 36638
5f6dcd83e8c1
permissions
-rw-r--r--

Renamed some prpl stuff to protocol stuff.
Renamed /plugins/prpl prefs to /protocols

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
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
30 #include "libyahoo.h"
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
31 #include "libymsg.h"
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
32 #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
33 #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
34 #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
35 #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
36 #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
37
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36536
diff changeset
38 static PurpleProtocol *my_protocol = NULL;
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
39
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
40 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
41 {
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
42 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
43 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
44 PURPLE_CMD_FLAG_PROTOCOL_ONLY,
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36628
diff changeset
45 "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
46 _("join &lt;room&gt;: Join a chat room on the Yahoo network"), NULL);
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
47 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
48 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
49 PURPLE_CMD_FLAG_PROTOCOL_ONLY,
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36628
diff changeset
50 "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
51 _("list: List rooms on the Yahoo network"), NULL);
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
52 purple_cmd_register("buzz", "", PURPLE_CMD_P_PROTOCOL,
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
53 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
54 "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
55 _("buzz: Buzz a user to get their attention"), NULL);
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
56 purple_cmd_register("doodle", "", PURPLE_CMD_P_PROTOCOL,
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
57 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
58 "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
59 _("doodle: Request user to start a Doodle session"), NULL);
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
60 }
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
61
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36628
diff changeset
62 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
63 {
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
64 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
65
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
66 /* 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
67 if (acct_id) {
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36628
diff changeset
68 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
69 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
70 acct = NULL;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
71 } 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
72 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
73 while (l) {
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36628
diff changeset
74 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
75 && 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
76 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
77 break;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
78 }
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
79 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
80 }
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
81 }
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
82
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
83 return acct;
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
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
86 /* 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
87 * 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
88 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
89 {
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
90 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
91
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
92 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
93 *retval = key;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
94 }
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
95 }
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
96
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
97 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
98 {
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
99 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
100 PurpleAccount *acct;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
101
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
102 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
103 return FALSE;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
104
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
105 acct = find_acct(purple_protocol_get_id(my_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
106
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
107 if (!acct)
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
108 return FALSE;
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 /* 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
111 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
112 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
113 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
114 if (sname) {
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
115 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
116
34642
5ef8e33e5bed Refactored sametime and yahoo protocols to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34635
diff changeset
117 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
118 sname, acct);
5ef8e33e5bed Refactored sametime and yahoo protocols to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34635
diff changeset
119 if (im == NULL)
5ef8e33e5bed Refactored sametime and yahoo protocols to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34635
diff changeset
120 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
121 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
122
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
123 if (message) {
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
124 /* 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
125 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
126 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
127 }
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
128 }
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
129 /* else
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
130 **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
131 * 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
132 pidgindialogs_im(); */
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 return TRUE;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
135 }
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
136 /* 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
137 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
138 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
139 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
140 if (rname) {
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
141 /* 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
142 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
143 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
144 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
145 }
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
146 /* else
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
147 ** 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
148 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
149
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
150 return TRUE;
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 /* 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
153 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
154 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
155 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
156 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
157 return TRUE;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
158 }
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 return FALSE;
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
161 }
27559
3007dde24778 Add header includes. I still have not yet tested building this.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27557
diff changeset
162
27557
08a8cbc0a0ec have a separate hash table function for each prpl.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27556
diff changeset
163 static GHashTable *
08a8cbc0a0ec have a separate hash table function for each prpl.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27556
diff changeset
164 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
165 {
08a8cbc0a0ec have a separate hash table function for each prpl.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27556
diff changeset
166 GHashTable *table;
08a8cbc0a0ec have a separate hash table function for each prpl.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27556
diff changeset
167 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
168 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
169 return table;
08a8cbc0a0ec have a separate hash table function for each prpl.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27556
diff changeset
170 }
08a8cbc0a0ec have a separate hash table function for each prpl.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27556
diff changeset
171
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36628
diff changeset
172 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
173 {
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
174 yahoo_doodle_start,
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
175 yahoo_doodle_end,
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
176 yahoo_doodle_get_dimensions,
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
177 NULL,
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
178 yahoo_doodle_get_brush,
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
179 yahoo_doodle_set_brush,
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
180 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
181 yahoo_doodle_clear,
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
182
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
183 /* padding */
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
184 NULL,
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
185 NULL,
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
186 NULL,
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
187 NULL
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
188 };
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
189
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
190 static void
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
191 yahoo_protocol_base_init(YahooProtocolClass *klass)
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
192 {
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
193 PurpleProtocolClass *proto_class = PURPLE_PROTOCOL_CLASS(klass);
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
194 PurpleAccountOption *option;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
195
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
196 proto_class->id = YAHOO_ID;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
197 proto_class->name = YAHOO_NAME;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
198 proto_class->options = OPT_PROTO_MAIL_CHECK | OPT_PROTO_CHAT_TOPIC |
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
199 OPT_PROTO_AUTHORIZATION_DENIED_MESSAGE;
36609
637155f87448 Refactored the protocols to use purple_buddy_icon_spec_new()
Ankit Vani <a@nevitus.org>
parents: 36598
diff changeset
200 proto_class->icon_spec = purple_buddy_icon_spec_new("png,gif,jpeg",
637155f87448 Refactored the protocols to use purple_buddy_icon_spec_new()
Ankit Vani <a@nevitus.org>
parents: 36598
diff changeset
201 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
202 PURPLE_ICON_SCALE_SEND);
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
203
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36628
diff changeset
204 proto_class->whiteboard_protocol_ops = &yahoo_whiteboard_ops;
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
205
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
206 option = purple_account_option_int_new(_("Pager port"), "port", YAHOO_PAGER_PORT);
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
207 proto_class->protocol_options = g_list_append(proto_class->protocol_options, option);
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
208
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
209 option = purple_account_option_string_new(_("File transfer server"), "xfer_host", YAHOO_XFER_HOST);
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
210 proto_class->protocol_options = g_list_append(proto_class->protocol_options, option);
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
211
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
212 option = purple_account_option_string_new(_("Chat room locale"), "room_list_locale", YAHOO_ROOMLIST_LOCALE);
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
213 proto_class->protocol_options = g_list_append(proto_class->protocol_options, option);
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
214
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
215 option = purple_account_option_string_new(_("Encoding"), "local_charset", "UTF-8");
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
216 proto_class->protocol_options = g_list_append(proto_class->protocol_options, option);
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
217
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
218 option = purple_account_option_bool_new(_("Ignore conference and chatroom invitations"), "ignore_invites", FALSE);
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
219 proto_class->protocol_options = g_list_append(proto_class->protocol_options, option);
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
220
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
221 #if 0
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
222 option = purple_account_option_bool_new(_("Use account proxy for HTTP and HTTPS connections"), "proxy_ssl", FALSE);
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
223 proto_class->protocol_options = g_list_append(proto_class->protocol_options, option);
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
224
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
225 option = purple_account_option_string_new(_("Chat room list URL"), "room_list", YAHOO_ROOMLIST_URL);
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
226 proto_class->protocol_options = g_list_append(proto_class->protocol_options, option);
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
227 #endif
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 yahoo_init_colorht();
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
230 }
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 static void
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
233 yahoo_protocol_base_finalize(YahooProtocolClass *klass)
27556
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
234 {
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
235 yahoo_dest_colorht();
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
236 }
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 static void
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
239 yahoo_protocol_interface_init(PurpleProtocolInterface *iface)
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 iface->get_actions = yahoo_get_actions;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
242 iface->list_icon = yahoo_list_icon;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
243 iface->list_emblem = yahoo_list_emblem;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
244 iface->status_text = yahoo_status_text;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
245 iface->tooltip_text = yahoo_tooltip_text;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
246 iface->status_types = yahoo_status_types;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
247 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
248 iface->chat_info = yahoo_c_info;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
249 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
250 iface->login = yahoo_login;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
251 iface->close = yahoo_close;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
252 iface->send_im = yahoo_send_im;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
253 iface->send_typing = yahoo_send_typing;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
254 iface->get_info = yahoo_get_info;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
255 iface->set_status = yahoo_set_status;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
256 iface->set_idle = yahoo_set_idle;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
257 iface->add_buddy = yahoo_add_buddy;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
258 iface->remove_buddy = yahoo_remove_buddy;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
259 iface->add_deny = yahoo_add_deny;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
260 iface->rem_deny = yahoo_rem_deny;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
261 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
262 iface->join_chat = yahoo_c_join;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
263 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
264 iface->chat_invite = yahoo_c_invite;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
265 iface->chat_leave = yahoo_c_leave;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
266 iface->chat_send = yahoo_c_send;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
267 iface->keepalive = yahoo_keepalive;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
268 iface->alias_buddy = yahoo_update_alias;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
269 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
270 iface->rename_group = yahoo_rename_group;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
271 iface->normalize = purple_normalize_nocase;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
272 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
273 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
274 iface->roomlist_cancel = yahoo_roomlist_cancel;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
275 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
276 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
277 iface->send_file = yahoo_send_file;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
278 iface->new_xfer = yahoo_new_xfer;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
279 iface->offline_message = yahoo_offline_message;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
280 iface->send_attention = yahoo_send_attention;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
281 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
282 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
283 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
284 }
27556
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
285
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
286 static PurplePluginInfo *
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
287 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
288 {
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
289 return purple_plugin_info_new(
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
290 "id", YAHOO_ID,
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
291 "name", YAHOO_NAME,
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
292 "version", DISPLAY_VERSION,
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
293 "category", N_("Protocol"),
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
294 "summary", N_("Yahoo! Protocol Plugin"),
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
295 "description", N_("Yahoo! Protocol Plugin"),
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
296 "website", PURPLE_WEBSITE,
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
297 "abi-version", PURPLE_ABI_VERSION,
36536
07f8c9889257 Added flags to all prpls
Ankit Vani <a@nevitus.org>
parents: 36534
diff changeset
298 "flags", GPLUGIN_PLUGIN_INFO_FLAGS_INTERNAL |
07f8c9889257 Added flags to all prpls
Ankit Vani <a@nevitus.org>
parents: 36534
diff changeset
299 GPLUGIN_PLUGIN_INFO_FLAGS_LOAD_ON_QUERY,
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
300 NULL
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
301 );
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
302 }
27556
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
303
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
304 static gboolean
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
305 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
306 {
36628
3d43ca8d69ee Refactored the protocols to use the error argument of purple_protocols_{add/remove}
Ankit Vani <a@nevitus.org>
parents: 36613
diff changeset
307 my_protocol = purple_protocols_add(YAHOO_TYPE_PROTOCOL, error);
3d43ca8d69ee Refactored the protocols to use the error argument of purple_protocols_{add/remove}
Ankit Vani <a@nevitus.org>
parents: 36613
diff changeset
308 if (!my_protocol)
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
309 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
310
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
311 yahoo_register_commands();
27556
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
312
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
313 purple_signal_connect(purple_get_core(), "uri-handler", my_protocol,
27556
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
314 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
315
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
316 return TRUE;
27556
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
317 }
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
318
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
319 static gboolean
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
320 plugin_unload(PurplePlugin *plugin, GError **error)
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
321 {
36628
3d43ca8d69ee Refactored the protocols to use the error argument of purple_protocols_{add/remove}
Ankit Vani <a@nevitus.org>
parents: 36613
diff changeset
322 if (!purple_protocols_remove(my_protocol, error))
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
323 return FALSE;
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
324
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
325 return TRUE;
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
326 }
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34878
diff changeset
327
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
328 static PurplePlugin *my_plugin;
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
329 PURPLE_PROTOCOL_DEFINE(my_plugin, YahooProtocol, yahoo_protocol);
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
330 PURPLE_PLUGIN_INIT_VAL(my_plugin, yahoo, plugin_query, plugin_load,
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
331 plugin_unload);

mercurial