Migrate certificates, icons, logs to XDG dirs
[pidgin-git.git] / libpurple / protocols / yahoo / yahoojp.c
blobc3872d73e138c2a232e38691e8a09a574c667d85
1 /*
2 * purple
4 * Purple is the legal property of its developers, whose names are too numerous
5 * to list here. Please refer to the COPYRIGHT file distributed with this
6 * source distribution.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
24 #include "internal.h"
26 #include <account.h>
27 #include <plugins.h>
29 #include "yahoojp.h"
30 #include "ymsg.h"
31 #include "yahoochat.h"
32 #include "yahoo_aliases.h"
33 #include "yahoo_doodle.h"
34 #include "yahoo_filexfer.h"
35 #include "yahoo_picture.h"
37 static GSList *cmds = NULL;
39 void yahoojp_register_commands(void)
41 PurpleCmdId id;
43 id = purple_cmd_register("join", "s", PURPLE_CMD_P_PROTOCOL,
44 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
45 PURPLE_CMD_FLAG_PROTOCOL_ONLY,
46 "prpl-yahoojp", yahoopurple_cmd_chat_join,
47 _("join &lt;room&gt;: Join a chat room on the Yahoo network"), NULL);
48 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
50 id = purple_cmd_register("list", "", PURPLE_CMD_P_PROTOCOL,
51 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
52 PURPLE_CMD_FLAG_PROTOCOL_ONLY,
53 "prpl-yahoojp", yahoopurple_cmd_chat_list,
54 _("list: List rooms on the Yahoo network"), NULL);
55 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
57 id = purple_cmd_register("buzz", "", PURPLE_CMD_P_PROTOCOL,
58 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PROTOCOL_ONLY,
59 "prpl-yahoojp", yahoopurple_cmd_buzz,
60 _("buzz: Buzz a user to get their attention"), NULL);
61 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
63 id = purple_cmd_register("doodle", "", PURPLE_CMD_P_PROTOCOL,
64 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PROTOCOL_ONLY,
65 "prpl-yahoojp", yahoo_doodle_purple_cmd_start,
66 _("doodle: Request user to start a Doodle session"), NULL);
67 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
70 void yahoojp_unregister_commands(void)
72 while (cmds) {
73 PurpleCmdId id = GPOINTER_TO_UINT(cmds->data);
74 purple_cmd_unregister(id);
75 cmds = g_slist_delete_link(cmds, cmds);
79 static GHashTable *
80 yahoojp_get_account_text_table(PurpleAccount *account)
82 GHashTable *table;
83 table = g_hash_table_new(g_str_hash, g_str_equal);
84 g_hash_table_insert(table, "login_label", (gpointer)_("Yahoo JAPAN ID..."));
85 return table;
88 static void
89 yahoojp_protocol_init(PurpleProtocol *protocol)
91 PurpleAccountOption *option;
93 protocol->id = "prpl-yahoojp";
94 protocol->name = "Yahoo JAPAN";
96 /* delete yahoo's protocol options */
97 purple_protocol_override(protocol, PURPLE_PROTOCOL_OVERRIDE_PROTOCOL_OPTIONS);
99 option = purple_account_option_int_new(_("Pager port"), "port", YAHOO_PAGER_PORT);
100 protocol->account_options = g_list_append(protocol->account_options, option);
102 option = purple_account_option_string_new(_("File transfer server"), "xfer_host", YAHOOJP_XFER_HOST);
103 protocol->account_options = g_list_append(protocol->account_options, option);
105 option = purple_account_option_string_new(_("Chat room locale"), "room_list_locale", YAHOOJP_ROOMLIST_LOCALE);
106 protocol->account_options = g_list_append(protocol->account_options, option);
108 option = purple_account_option_string_new(_("Encoding"), "local_charset", "UTF-8");
109 protocol->account_options = g_list_append(protocol->account_options, option);
111 option = purple_account_option_bool_new(_("Ignore conference and chatroom invitations"), "ignore_invites", FALSE);
112 protocol->account_options = g_list_append(protocol->account_options, option);
115 static void
116 yahoojp_protocol_class_init(PurpleProtocolClass *klass)
120 static void
121 yahoojp_protocol_client_iface_init(PurpleProtocolClientIface *client_iface)
123 client_iface->get_account_text_table = yahoojp_get_account_text_table;
126 PURPLE_DEFINE_TYPE_EXTENDED(
127 YahooJPProtocol, yahoojp_protocol, YAHOO_TYPE_PROTOCOL, 0,
129 PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_CLIENT_IFACE,
130 yahoojp_protocol_client_iface_init)