libpurple/protocols/oscar/icq.c

Tue, 03 May 2016 14:04:15 -0400

author
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
date
Tue, 03 May 2016 14:04:15 -0400
changeset 37759
35e8677c6ce5
parent 37163
bdaa6ae19356
child 37761
4b57eced35d5
permissions
-rw-r--r--

oscar: Prepend server option instead of appending it

This allows server/port to be together and appear on top of the
advanced settings instead of having port on top and server at the bottom

15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15685
diff changeset
1 /* purple
15030
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15685
diff changeset
3 * Purple is the legal property of its developers, whose names are too numerous
15030
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
4 * to list here. Please refer to the COPYRIGHT file distributed with this
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
5 * source distribution.
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
6 *
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
10 * (at your option) any later version.
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
11 *
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
15 * GNU General Public License for more details.
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
16 *
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19050
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15030
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
20 *
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
21 */
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
22
36666
5739f1f04078 Build a single library for oscar.
Ankit Vani <a@nevitus.org>
parents: 36657
diff changeset
23 #include "icq.h"
36657
4a7f5f97d1ec Make sure internal.h is included first
Ankit Vani <a@nevitus.org>
parents: 36653
diff changeset
24
36590
e77919ff5e74 Refactored oscar to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
25 #include "core.h"
36530
b8caab360c96 Refactored oscar to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 33696
diff changeset
26 #include "plugins.h"
36590
e77919ff5e74 Refactored oscar to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
27 #include "signals.h"
15030
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
28
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
29 #include "oscarcommon.h"
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
30
24235
46abfb2f03e4 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23277
diff changeset
31 static GHashTable *
46abfb2f03e4 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23277
diff changeset
32 icq_get_account_text_table(PurpleAccount *account)
46abfb2f03e4 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23277
diff changeset
33 {
46abfb2f03e4 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23277
diff changeset
34 GHashTable *table;
46abfb2f03e4 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23277
diff changeset
35 table = g_hash_table_new(g_str_hash, g_str_equal);
46abfb2f03e4 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23277
diff changeset
36 g_hash_table_insert(table, "login_label", (gpointer)_("ICQ UIN..."));
46abfb2f03e4 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23277
diff changeset
37 return table;
46abfb2f03e4 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23277
diff changeset
38 }
46abfb2f03e4 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23277
diff changeset
39
34321
f60fcab02bd4 Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34312
diff changeset
40 static gssize
f60fcab02bd4 Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34312
diff changeset
41 icq_get_max_message_size(PurpleConversation *conv)
34312
4461d5c1e61c Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33696
diff changeset
42 {
34321
f60fcab02bd4 Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34312
diff changeset
43 /* XXX: got from pidgin-otr - verify and document it */
34312
4461d5c1e61c Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33696
diff changeset
44 return 2346;
4461d5c1e61c Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33696
diff changeset
45 }
4461d5c1e61c Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33696
diff changeset
46
36590
e77919ff5e74 Refactored oscar to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
47 static void
36684
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
48 icq_protocol_init(PurpleProtocol *protocol)
15030
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
49 {
36590
e77919ff5e74 Refactored oscar to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
50 PurpleAccountOption *option;
e77919ff5e74 Refactored oscar to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
51
37004
c8dce7bef0e6 Change protocol IDs to prpl-*
Ankit Vani <a@nevitus.org>
parents: 36735
diff changeset
52 protocol->id = "prpl-icq";
36684
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
53 protocol->name = "ICQ";
15030
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
54
37038
8832d14d7d0c Rename 'protocol_options' field of PurpleProtocol to more appropriate 'account_options'
Ankit Vani <a@nevitus.org>
parents: 37004
diff changeset
55 oscar_init_account_options(protocol);
36650
7b581b0a96d4 Initialize oscar protocol options in libaim and libicq so that they know who they are
Ankit Vani <a@nevitus.org>
parents: 36642
diff changeset
56
36590
e77919ff5e74 Refactored oscar to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
57 option = purple_account_option_string_new(_("Server"), "server", oscar_get_login_server(TRUE, TRUE));
37759
35e8677c6ce5 oscar: Prepend server option instead of appending it
Youness Alaoui <kakaroto@kakaroto.homelinux.net>
parents: 37163
diff changeset
58 protocol->account_options = g_list_prepend(protocol->account_options, option);
15030
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
59
36590
e77919ff5e74 Refactored oscar to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
60 option = purple_account_option_string_new(_("Encoding"), "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING);
37038
8832d14d7d0c Rename 'protocol_options' field of PurpleProtocol to more appropriate 'account_options'
Ankit Vani <a@nevitus.org>
parents: 37004
diff changeset
61 protocol->account_options = g_list_append(protocol->account_options, option);
36684
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
62 }
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
63
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
64 static void
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
65 icq_protocol_class_init(PurpleProtocolClass *klass)
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
66 {
36735
e336804e65d2 Refactored oscar to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
67 klass->list_icon = oscar_list_icon_icq;
36590
e77919ff5e74 Refactored oscar to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
68 }
15030
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
69
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
70 static void
36729
7f9fac14ed60 Temporarily replaced PurpleProtocolInterface with PurpleProtocolClientIface in protocols
Ankit Vani <a@nevitus.org>
parents: 36714
diff changeset
71 icq_protocol_client_iface_init(PurpleProtocolClientIface *client_iface)
15030
6a6cf7be07ea [gaim-migrate @ 17747]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
72 {
36729
7f9fac14ed60 Temporarily replaced PurpleProtocolInterface with PurpleProtocolClientIface in protocols
Ankit Vani <a@nevitus.org>
parents: 36714
diff changeset
73 client_iface->get_account_text_table = icq_get_account_text_table;
7f9fac14ed60 Temporarily replaced PurpleProtocolInterface with PurpleProtocolClientIface in protocols
Ankit Vani <a@nevitus.org>
parents: 36714
diff changeset
74 client_iface->get_moods = oscar_get_purple_moods;
7f9fac14ed60 Temporarily replaced PurpleProtocolInterface with PurpleProtocolClientIface in protocols
Ankit Vani <a@nevitus.org>
parents: 36714
diff changeset
75 client_iface->get_max_message_size = icq_get_max_message_size;
36590
e77919ff5e74 Refactored oscar to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
76 }
e77919ff5e74 Refactored oscar to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36583
diff changeset
77
36714
ec178f7d66da Refactored protocols to use the new type definition macros
Ankit Vani <a@nevitus.org>
parents: 36684
diff changeset
78 PURPLE_DEFINE_TYPE_EXTENDED(
ec178f7d66da Refactored protocols to use the new type definition macros
Ankit Vani <a@nevitus.org>
parents: 36684
diff changeset
79 ICQProtocol, icq_protocol, OSCAR_TYPE_PROTOCOL, 0,
36735
e336804e65d2 Refactored oscar to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
80
36729
7f9fac14ed60 Temporarily replaced PurpleProtocolInterface with PurpleProtocolClientIface in protocols
Ankit Vani <a@nevitus.org>
parents: 36714
diff changeset
81 PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_CLIENT_IFACE,
36735
e336804e65d2 Refactored oscar to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
82 icq_protocol_client_iface_init)
36714
ec178f7d66da Refactored protocols to use the new type definition macros
Ankit Vani <a@nevitus.org>
parents: 36684
diff changeset
83 );

mercurial