libpurple/protocols/yahoo/libyahoojp.c

Thu, 29 Aug 2013 08:13:05 +0530

author
Ankit Vani <a@nevitus.org>
date
Thu, 29 Aug 2013 08:13:05 +0530
branch
soc.2013.gobjectification.plugins
changeset 36603
182bd3d0839e
parent 36598
f1efde508b03
child 36613
0e96218aa13a
permissions
-rw-r--r--

Added 'yahoo' as a dependency of 'yahoojp'

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>
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34286
diff changeset
27 #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
28
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
29 #include "libyahoojp.h"
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
30 #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
31 #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
32 #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
33 #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
34 #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
35 #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
36
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
37 static PurpleProtocol *my_protocol = NULL;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
38
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
39 static void yahoojp_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
40 {
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
41 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
42 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
43 PURPLE_CMD_FLAG_PROTOCOL_ONLY,
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
44 "prpl-yahoojp", yahoopurple_cmd_chat_join,
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
45 _("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
46 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
47 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
48 PURPLE_CMD_FLAG_PROTOCOL_ONLY,
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
49 "prpl-yahoojp", yahoopurple_cmd_chat_list,
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
50 _("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
51 purple_cmd_register("buzz", "", PURPLE_CMD_P_PROTOCOL,
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
52 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PROTOCOL_ONLY,
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
53 "prpl-yahoojp", yahoopurple_cmd_buzz,
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
54 _("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
55 purple_cmd_register("doodle", "", PURPLE_CMD_P_PROTOCOL,
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
56 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PROTOCOL_ONLY,
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
57 "prpl-yahoojp", yahoo_doodle_purple_cmd_start,
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
58 _("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
59 }
27559
3007dde24778 Add header includes. I still have not yet tested building this.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27557
diff changeset
60
27557
08a8cbc0a0ec have a separate hash table function for each prpl.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27556
diff changeset
61 static GHashTable *
08a8cbc0a0ec have a separate hash table function for each prpl.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27556
diff changeset
62 yahoojp_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
63 {
08a8cbc0a0ec have a separate hash table function for each prpl.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27556
diff changeset
64 GHashTable *table;
08a8cbc0a0ec have a separate hash table function for each prpl.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27556
diff changeset
65 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
66 g_hash_table_insert(table, "login_label", (gpointer)_("Yahoo JAPAN ID..."));
08a8cbc0a0ec have a separate hash table function for each prpl.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27556
diff changeset
67 return table;
08a8cbc0a0ec have a separate hash table function for each prpl.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27556
diff changeset
68 }
08a8cbc0a0ec have a separate hash table function for each prpl.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27556
diff changeset
69
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
70 static void
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
71 yahoojp_protocol_base_init(YahooJPProtocolClass *klass)
27556
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
72 {
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
73 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
74 PurpleAccountOption *option;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
75
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
76 proto_class->id = YAHOOJP_ID;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
77 proto_class->name = YAHOOJP_NAME;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
78
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
79 /* delete yahoo's protocol options */
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
80 while (proto_class->protocol_options) {
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
81 PurpleAccountOption *option = proto_class->protocol_options->data;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
82 purple_account_option_destroy(option);
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
83 proto_class->protocol_options =
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
84 g_list_delete_link(proto_class->protocol_options,
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
85 proto_class->protocol_options);
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
86 }
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
87
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
88 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
89 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
90
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
91 option = purple_account_option_string_new(_("File transfer server"), "xfer_host", YAHOOJP_XFER_HOST);
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
92 proto_class->protocol_options = g_list_append(proto_class->protocol_options, option);
27556
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
93
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
94 option = purple_account_option_string_new(_("Chat room locale"), "room_list_locale", YAHOOJP_ROOMLIST_LOCALE);
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
95 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
96
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
97 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
98 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
99
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
100 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
101 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
102 }
27556
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
103
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
104 static void
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
105 yahoojp_protocol_interface_init(PurpleProtocolInterface *iface)
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
106 {
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
107 iface->get_account_text_table = yahoojp_get_account_text_table;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
108
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
109 /* disable yahoo functions not available for yahoojp */
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
110 iface->can_receive_file = NULL;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
111 }
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
112
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
113 static void yahoojp_protocol_base_finalize(YahooJPProtocolClass *klass) { }
27556
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
114
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34286
diff changeset
115 static PurplePluginInfo *
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34286
diff changeset
116 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
117 {
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34286
diff changeset
118 return purple_plugin_info_new(
36603
182bd3d0839e Added 'yahoo' as a dependency of 'yahoojp'
Ankit Vani <a@nevitus.org>
parents: 36598
diff changeset
119 "id", YAHOOJP_ID,
182bd3d0839e Added 'yahoo' as a dependency of 'yahoojp'
Ankit Vani <a@nevitus.org>
parents: 36598
diff changeset
120 "name", YAHOOJP_NAME,
182bd3d0839e Added 'yahoo' as a dependency of 'yahoojp'
Ankit Vani <a@nevitus.org>
parents: 36598
diff changeset
121 "version", DISPLAY_VERSION,
182bd3d0839e Added 'yahoo' as a dependency of 'yahoojp'
Ankit Vani <a@nevitus.org>
parents: 36598
diff changeset
122 "category", N_("Protocol"),
182bd3d0839e Added 'yahoo' as a dependency of 'yahoojp'
Ankit Vani <a@nevitus.org>
parents: 36598
diff changeset
123 "summary", N_("Yahoo! JAPAN Protocol Plugin"),
182bd3d0839e Added 'yahoo' as a dependency of 'yahoojp'
Ankit Vani <a@nevitus.org>
parents: 36598
diff changeset
124 "description", N_("Yahoo! JAPAN Protocol Plugin"),
182bd3d0839e Added 'yahoo' as a dependency of 'yahoojp'
Ankit Vani <a@nevitus.org>
parents: 36598
diff changeset
125 "website", PURPLE_WEBSITE,
182bd3d0839e Added 'yahoo' as a dependency of 'yahoojp'
Ankit Vani <a@nevitus.org>
parents: 36598
diff changeset
126 "abi-version", PURPLE_ABI_VERSION,
182bd3d0839e Added 'yahoo' as a dependency of 'yahoojp'
Ankit Vani <a@nevitus.org>
parents: 36598
diff changeset
127 "dependencies", YAHOO_ID,
182bd3d0839e Added 'yahoo' as a dependency of 'yahoojp'
Ankit Vani <a@nevitus.org>
parents: 36598
diff changeset
128 "flags", GPLUGIN_PLUGIN_INFO_FLAGS_INTERNAL |
182bd3d0839e Added 'yahoo' as a dependency of 'yahoojp'
Ankit Vani <a@nevitus.org>
parents: 36598
diff changeset
129 GPLUGIN_PLUGIN_INFO_FLAGS_LOAD_ON_QUERY,
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34286
diff changeset
130 NULL
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34286
diff changeset
131 );
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34286
diff changeset
132 }
27556
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
133
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34286
diff changeset
134 static gboolean
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34286
diff changeset
135 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
136 {
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
137 my_protocol = purple_protocols_add(YAHOOJP_TYPE_PROTOCOL);
27556
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
138
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
139 if (!my_protocol) {
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
140 g_set_error(error, YAHOOJP_DOMAIN, 0, _("Failed to add yahoojp protocol"));
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
141 return FALSE;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
142 }
27556
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
143
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27559
diff changeset
144 yahoojp_register_commands();
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34286
diff changeset
145
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34286
diff changeset
146 return TRUE;
27556
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
147 }
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
148
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34286
diff changeset
149 static gboolean
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34286
diff changeset
150 plugin_unload(PurplePlugin *plugin, GError **error)
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34286
diff changeset
151 {
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
152 if (!purple_protocols_remove(my_protocol)) {
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
153 g_set_error(error, YAHOOJP_DOMAIN, 0, _("Failed to remove yahoojp protocol"));
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
154 return FALSE;
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
155 }
27556
3daffa5f82dd Very rudimentary start to separate prpls. Removed URI handler from the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
156
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34286
diff changeset
157 return TRUE;
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34286
diff changeset
158 }
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34286
diff changeset
159
36598
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
160 PURPLE_PROTOCOL_DEFINE_EXTENDED(YahooJPProtocol, yahoojp_protocol,
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
161 YAHOO_TYPE_PROTOCOL, 0);
f1efde508b03 Refactored yahoo to use the new protocol API.
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
162
36534
c582c94a71ac Refactored yahoo to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34286
diff changeset
163 PURPLE_PLUGIN_INIT(yahoojp, plugin_query, plugin_load, plugin_unload);

mercurial