libpurple/protocols/mxit/mxit.c

Tue, 27 Aug 2013 04:30:39 +0530

author
Ankit Vani <a@nevitus.org>
date
Tue, 27 Aug 2013 04:30:39 +0530
branch
soc.2013.gobjectification.plugins
changeset 36583
0582190c9382
parent 36545
23b59a16c808
parent 34894
df5ed3731148
child 36585
cd3ea761181c
permissions
-rw-r--r--

Merged soc.2013.gobjectification branch

28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
1 /*
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
2 * MXit Protocol libPurple Plugin
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
3 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
4 * -- MXit libPurple plugin API --
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
5 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
6 * Pieter Loubser <libpurple@mxit.com>
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
7 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
8 * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
9 * <http://www.mxitlifestyle.com>
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
10 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
14 * (at your option) any later version.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
15 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
19 * GNU General Public License for more details.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
20 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
24 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
25
33844
e8edfd4e26ae MXit: Cleanup the #includes (no purple.h) so that it atleast compiles within InstantBird.
Andrew Victor <andrew.victor@mxit.com>
parents: 33831
diff changeset
26 #include "internal.h"
e8edfd4e26ae MXit: Cleanup the #includes (no purple.h) so that it atleast compiles within InstantBird.
Andrew Victor <andrew.victor@mxit.com>
parents: 33831
diff changeset
27 #include "debug.h"
e8edfd4e26ae MXit: Cleanup the #includes (no purple.h) so that it atleast compiles within InstantBird.
Andrew Victor <andrew.victor@mxit.com>
parents: 33831
diff changeset
28 #include "accountopt.h"
36524
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
29 #include "plugins.h"
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
30 #include "version.h"
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
31
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
32 #include "mxit.h"
36542
30f40ecc4631 Renamed mxit's protocol.[ch] to client.[ch]
Ankit Vani <a@nevitus.org>
parents: 36541
diff changeset
33 #include "client.h"
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
34 #include "login.h"
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
35 #include "roster.h"
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
36 #include "chunk.h"
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
37 #include "filexfer.h"
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
38 #include "actions.h"
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
39 #include "multimx.h"
31491
cf74b88370ea The initial protocol infrastructure for MXit Voice/Video support.
Andrew Victor <andrew.victor@mxit.com>
parents: 31490
diff changeset
40 #include "voicevideo.h"
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
41
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
42
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
43 #ifdef MXIT_LINK_CLICK
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
44
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
45
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
46 /* pidgin callback function pointers for URI click interception */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
47 static void *(*mxit_pidgin_uri_cb)(const char *uri);
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
48 static PurpleNotifyUiOps* mxit_nots_override_original;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
49 static PurpleNotifyUiOps mxit_nots_override;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
50 static int not_link_ref_count = 0;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
51
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
52
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
53 /*------------------------------------------------------------------------
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
54 * Handle an URI clicked on the UI
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
55 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
56 * @param link the link name which has been clicked
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
57 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
58 static void* mxit_link_click( const char* link64 )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
59 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
60 PurpleAccount* account;
33617
554bc9cc52a8 MXit: When sending a structured response when the user clicks on a link, the format of the response message was not totally correct.
Andrew Victor <andrew.victor@mxit.com>
parents: 33614
diff changeset
61 PurpleConnection* gc;
29216
9284748dd744 Add extra parameter to mxit_send_message() function to indicate if the message should be
Andrew Victor <andrew.victor@mxit.com>
parents: 29162
diff changeset
62 gchar** parts = NULL;
9284748dd744 Add extra parameter to mxit_send_message() function to indicate if the message should be
Andrew Victor <andrew.victor@mxit.com>
parents: 29162
diff changeset
63 gchar* link = NULL;
28945
f94c51ec07d9 Mark a bunch of mxit strings for translation
Mark Doliner <markdoliner@pidgin.im>
parents: 28918
diff changeset
64 gsize len;
29216
9284748dd744 Add extra parameter to mxit_send_message() function to indicate if the message should be
Andrew Victor <andrew.victor@mxit.com>
parents: 29162
diff changeset
65 gboolean is_command = FALSE;
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
66
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
67 purple_debug_info( MXIT_PLUGIN_ID, "mxit_link_click (%s)\n", link64 );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
68
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
69 if ( g_ascii_strncasecmp( link64, MXIT_LINK_PREFIX, strlen( MXIT_LINK_PREFIX ) ) != 0 ) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
70 /* this is not for us */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
71 goto skip;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
72 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
73
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
74 /* decode the base64 payload */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
75 link = (gchar*) purple_base64_decode( link64 + strlen( MXIT_LINK_PREFIX ), &len );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
76 purple_debug_info( MXIT_PLUGIN_ID, "Clicked Link: '%s'\n", link );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
77
33617
554bc9cc52a8 MXit: When sending a structured response when the user clicks on a link, the format of the response message was not totally correct.
Andrew Victor <andrew.victor@mxit.com>
parents: 33614
diff changeset
78 parts = g_strsplit( link, "|", 6 );
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
79
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
80 /* check if this is a valid mxit link */
33617
554bc9cc52a8 MXit: When sending a structured response when the user clicks on a link, the format of the response message was not totally correct.
Andrew Victor <andrew.victor@mxit.com>
parents: 33614
diff changeset
81 if ( ( !parts ) || ( !parts[0] ) || ( !parts[1] ) || ( !parts[2] ) || ( !parts[3] ) || ( !parts[4] ) || ( !parts[5] ) ) {
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
82 /* this is not for us */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
83 goto skip;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
84 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
85 else if ( g_ascii_strcasecmp( parts[0], MXIT_LINK_KEY ) != 0 ) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
86 /* this is not for us */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
87 goto skip;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
88 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
89
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
90 /* find the account */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
91 account = purple_accounts_find( parts[1], parts[2] );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
92 if ( !account )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
93 goto skip;
33617
554bc9cc52a8 MXit: When sending a structured response when the user clicks on a link, the format of the response message was not totally correct.
Andrew Victor <andrew.victor@mxit.com>
parents: 33614
diff changeset
94 gc = purple_account_get_connection( account );
554bc9cc52a8 MXit: When sending a structured response when the user clicks on a link, the format of the response message was not totally correct.
Andrew Victor <andrew.victor@mxit.com>
parents: 33614
diff changeset
95 if ( !gc )
30523
2629bf405a36 If a link is clicked in a conversation, and connection to server happens to have
Andrew Victor <andrew.victor@mxit.com>
parents: 30519
diff changeset
96 goto skip;
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
97
30209
7da1e54600f4 This change is also needed to make the "nm=" clickable links work.
Andrew Victor <andrew.victor@mxit.com>
parents: 30177
diff changeset
98 /* determine if it's a command-response to send */
33617
554bc9cc52a8 MXit: When sending a structured response when the user clicks on a link, the format of the response message was not totally correct.
Andrew Victor <andrew.victor@mxit.com>
parents: 33614
diff changeset
99 is_command = ( atoi( parts[4] ) == 1 );
30176
b380932e86ea Add support for the standard Mood API.
Andrew Victor <andrew.victor@mxit.com>
parents: 30138
diff changeset
100
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
101 /* send click message back to MXit */
33617
554bc9cc52a8 MXit: When sending a structured response when the user clicks on a link, the format of the response message was not totally correct.
Andrew Victor <andrew.victor@mxit.com>
parents: 33614
diff changeset
102 mxit_send_message( purple_connection_get_protocol_data( gc ), parts[3], parts[5], FALSE, is_command );
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
103
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
104 g_free( link );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
105 link = NULL;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
106 g_strfreev( parts );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
107 parts = NULL;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
108
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
109 return (void*) link64;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
110
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
111 skip:
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
112 /* this is not an internal mxit link */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
113
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
114 if ( link )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
115 g_free( link );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
116 link = NULL;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
117
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
118 if ( parts )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
119 g_strfreev( parts );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
120 parts = NULL;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
121
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
122 if ( mxit_pidgin_uri_cb )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
123 return mxit_pidgin_uri_cb( link64 );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
124 else
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
125 return (void*) link64;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
126 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
127
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
128
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
129 /*------------------------------------------------------------------------
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
130 * Register MXit to receive URI click notifications from the UI
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
131 */
33831
d160ede64878 MXit: Whitespace changes for coding-style consistency.
Andrew Victor <andrew.victor@mxit.com>
parents: 33829
diff changeset
132 void mxit_register_uri_handler( void )
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
133 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
134 not_link_ref_count++;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
135 if ( not_link_ref_count == 1 ) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
136 /* make copy of notifications */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
137 mxit_nots_override_original = purple_notify_get_ui_ops();
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
138 memcpy( &mxit_nots_override, mxit_nots_override_original, sizeof( PurpleNotifyUiOps ) );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
139
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
140 /* save previously configured callback function pointer */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
141 mxit_pidgin_uri_cb = mxit_nots_override.notify_uri;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
142
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
143 /* override the URI function call with MXit's own one */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
144 mxit_nots_override.notify_uri = mxit_link_click;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
145 purple_notify_set_ui_ops( &mxit_nots_override );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
146 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
147 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
148
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
149
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
150 /*------------------------------------------------------------------------
30310
da2adcf3b4a0 Some spelling fixes to code comments.
Andrew Victor <andrew.victor@mxit.com>
parents: 30214
diff changeset
151 * Unregister MXit from receiving URI click notifications from the UI
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
152 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
153 static void mxit_unregister_uri_handler()
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
154 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
155 not_link_ref_count--;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
156 if ( not_link_ref_count == 0 ) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
157 /* restore the notifications to its original state */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
158 purple_notify_set_ui_ops( mxit_nots_override_original );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
159 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
160 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
161
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
162 #endif
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
163
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
164
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
165 /*------------------------------------------------------------------------
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
166 * This gets called when a new chat conversation is opened by the user
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
167 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
168 * @param conv The conversation object
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
169 * @param session The MXit session object
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
170 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
171 static void mxit_cb_chat_created( PurpleConversation* conv, struct MXitSession* session )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
172 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
173 PurpleConnection* gc;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
174 struct contact* contact;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
175 PurpleBuddy* buddy;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
176 const char* who;
28950
6690518db5e2 Finish making this change that I started earlier today. This doesn't
Mark Doliner <markdoliner@pidgin.im>
parents: 28945
diff changeset
177 char* tmp;
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
178
32698
154e4a2a6287 Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32338
diff changeset
179 gc = purple_conversation_get_connection( conv );
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
180 if ( session->con != gc ) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
181 /* not our conversation */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
182 return;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
183 }
34637
9cdc9e6eecce Refactored mxit and myspace protocols to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
184 else if ( PURPLE_IS_CHAT_CONVERSATION( conv ) ) {
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
185 /* wrong type of conversation */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
186 return;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
187 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
188
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
189 /* get the contact name */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
190 who = purple_conversation_get_name( conv );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
191 if ( !who )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
192 return;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
193
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
194 purple_debug_info( MXIT_PLUGIN_ID, "Conversation started with '%s'\n", who );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
195
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
196 /* find the buddy object */
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34706
diff changeset
197 buddy = purple_blist_find_buddy( session->acc, who );
29667
9c7cdbf30435 struct hiding updates for mxit
Gary Kramlich <grim@reaperworld.com>
parents: 29106
diff changeset
198 if ( !buddy )
9c7cdbf30435 struct hiding updates for mxit
Gary Kramlich <grim@reaperworld.com>
parents: 29106
diff changeset
199 return;
9c7cdbf30435 struct hiding updates for mxit
Gary Kramlich <grim@reaperworld.com>
parents: 29106
diff changeset
200
33831
d160ede64878 MXit: Whitespace changes for coding-style consistency.
Andrew Victor <andrew.victor@mxit.com>
parents: 33829
diff changeset
201 contact = purple_buddy_get_protocol_data( buddy );
29667
9c7cdbf30435 struct hiding updates for mxit
Gary Kramlich <grim@reaperworld.com>
parents: 29106
diff changeset
202 if ( !contact )
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
203 return;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
204
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
205 /* we ignore all conversations with which we have chatted with in this session */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
206 if ( find_active_chat( session->active_chats, who ) )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
207 return;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
208
30310
da2adcf3b4a0 Some spelling fixes to code comments.
Andrew Victor <andrew.victor@mxit.com>
parents: 30214
diff changeset
209 /* determine if this buddy is a MXit service */
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
210 switch ( contact->type ) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
211 case MXIT_TYPE_BOT :
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
212 case MXIT_TYPE_CHATROOM :
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
213 case MXIT_TYPE_GALLERY :
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
214 case MXIT_TYPE_INFO :
28957
72b74fb2c159 A few other minor little translation-related fixes
Mark Doliner <markdoliner@pidgin.im>
parents: 28950
diff changeset
215 tmp = g_strdup_printf("<font color=\"#999999\">%s</font>\n", _( "Loading menu..." ));
28950
6690518db5e2 Finish making this change that I started earlier today. This doesn't
Mark Doliner <markdoliner@pidgin.im>
parents: 28945
diff changeset
216 serv_got_im( session->con, who, tmp, PURPLE_MESSAGE_NOTIFY, time( NULL ) );
33831
d160ede64878 MXit: Whitespace changes for coding-style consistency.
Andrew Victor <andrew.victor@mxit.com>
parents: 33829
diff changeset
217 g_free( tmp );
29216
9284748dd744 Add extra parameter to mxit_send_message() function to indicate if the message should be
Andrew Victor <andrew.victor@mxit.com>
parents: 29162
diff changeset
218 mxit_send_message( session, who, " ", FALSE, FALSE );
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
219 default :
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
220 break;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
221 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
222 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
223
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
224
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
225 /*------------------------------------------------------------------------
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
226 * Enable some signals to handled by our plugin
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
227 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
228 * @param session The MXit session object
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
229 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
230 void mxit_enable_signals( struct MXitSession* session )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
231 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
232 /* enable the signal when a new conversation is opened by the user */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
233 purple_signal_connect_priority( purple_conversations_get_handle(), "conversation-created", session, PURPLE_CALLBACK( mxit_cb_chat_created ),
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
234 session, PURPLE_SIGNAL_PRIORITY_HIGHEST );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
235 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
236
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
237
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
238 /*------------------------------------------------------------------------
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
239 * Disable some signals handled by our plugin
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
240 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
241 * @param session The MXit session object
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
242 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
243 static void mxit_disable_signals( struct MXitSession* session )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
244 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
245 /* disable the signal when a new conversation is opened by the user */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
246 purple_signal_disconnect( purple_conversations_get_handle(), "conversation-created", session, PURPLE_CALLBACK( mxit_cb_chat_created ) );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
247 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
248
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
249
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
250 /*------------------------------------------------------------------------
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
251 * Return the base icon name.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
252 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
253 * @param account The MXit account object
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
254 * @param buddy The buddy
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
255 * @return The icon name (excluding extension)
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
256 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
257 static const char* mxit_list_icon( PurpleAccount* account, PurpleBuddy* buddy )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
258 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
259 return "mxit";
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
260 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
261
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
262
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
263 /*------------------------------------------------------------------------
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
264 * Return the emblem icon name.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
265 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
266 * @param buddy The buddy
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
267 * @return The icon name (excluding extension)
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
268 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
269 static const char* mxit_list_emblem( PurpleBuddy* buddy )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
270 {
33831
d160ede64878 MXit: Whitespace changes for coding-style consistency.
Andrew Victor <andrew.victor@mxit.com>
parents: 33829
diff changeset
271 struct contact* contact = purple_buddy_get_protocol_data( buddy );
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
272
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
273 if ( !contact )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
274 return NULL;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
275
29162
a8dbd7e1a937 Display the "not-authorized" emblem if the MXit contact's subscription state
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
276 /* subscription state is Pending, Rejected or Deleted */
a8dbd7e1a937 Display the "not-authorized" emblem if the MXit contact's subscription state
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
277 if ( contact->subtype != MXIT_SUBTYPE_BOTH )
a8dbd7e1a937 Display the "not-authorized" emblem if the MXit contact's subscription state
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
278 return "not-authorized";
a8dbd7e1a937 Display the "not-authorized" emblem if the MXit contact's subscription state
Andrew Victor <andrew.victor@mxit.com>
parents: 29106
diff changeset
279
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
280 switch ( contact-> type ) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
281 case MXIT_TYPE_JABBER : /* external contacts via MXit */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
282 case MXIT_TYPE_MSN :
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
283 case MXIT_TYPE_YAHOO :
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
284 case MXIT_TYPE_ICQ :
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
285 case MXIT_TYPE_AIM :
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
286 case MXIT_TYPE_QQ :
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
287 case MXIT_TYPE_WV :
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
288 return "external";
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
289
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
290 case MXIT_TYPE_BOT : /* MXit services */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
291 case MXIT_TYPE_GALLERY :
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
292 case MXIT_TYPE_INFO :
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
293 return "bot";
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
294
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
295 case MXIT_TYPE_CHATROOM : /* MXit group chat services */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
296 case MXIT_TYPE_MULTIMX :
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
297 default:
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
298 return NULL;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
299 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
300 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
301
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
302
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
303 /*------------------------------------------------------------------------
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
304 * Return short string representing buddy's status for display on buddy list.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
305 * Returns status message (if one is set), or otherwise the mood.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
306 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
307 * @param buddy The buddy.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
308 * @return The status text
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
309 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
310 char* mxit_status_text( PurpleBuddy* buddy )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
311 {
33614
03bb2e5cb1d0 MXit: The buddy's name was not centered vertically in the buddy-list if they did not have a status-message or mood set.
Andrew Victor <andrew.victor@mxit.com>
parents: 33613
diff changeset
312 char* text = NULL;
33831
d160ede64878 MXit: Whitespace changes for coding-style consistency.
Andrew Victor <andrew.victor@mxit.com>
parents: 33829
diff changeset
313 struct contact* contact = purple_buddy_get_protocol_data( buddy );
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
314
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
315 if ( !contact )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
316 return NULL;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
317
33614
03bb2e5cb1d0 MXit: The buddy's name was not centered vertically in the buddy-list if they did not have a status-message or mood set.
Andrew Victor <andrew.victor@mxit.com>
parents: 33613
diff changeset
318 if ( contact->statusMsg ) /* status message */
33829
837d3061532b MXit: Use the accessor functions were available.
Andrew Victor <andrew.victor@mxit.com>
parents: 33718
diff changeset
319 text = g_strdup( contact-> statusMsg );
33614
03bb2e5cb1d0 MXit: The buddy's name was not centered vertically in the buddy-list if they did not have a status-message or mood set.
Andrew Victor <andrew.victor@mxit.com>
parents: 33613
diff changeset
320 else if ( contact->mood != MXIT_MOOD_NONE ) /* mood */
33829
837d3061532b MXit: Use the accessor functions were available.
Andrew Victor <andrew.victor@mxit.com>
parents: 33718
diff changeset
321 text = g_strdup( mxit_convert_mood_to_name( contact->mood ) );
33614
03bb2e5cb1d0 MXit: The buddy's name was not centered vertically in the buddy-list if they did not have a status-message or mood set.
Andrew Victor <andrew.victor@mxit.com>
parents: 33613
diff changeset
322
03bb2e5cb1d0 MXit: The buddy's name was not centered vertically in the buddy-list if they did not have a status-message or mood set.
Andrew Victor <andrew.victor@mxit.com>
parents: 33613
diff changeset
323 return text;
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
324 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
325
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
326
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
327 /*------------------------------------------------------------------------
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
328 * Return UI tooltip information for a buddy when hovering in buddy list.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
329 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
330 * @param buddy The buddy
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
331 * @param info The tooltip info being returned
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
332 * @param full Return full or summarized information
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
333 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
334 static void mxit_tooltip( PurpleBuddy* buddy, PurpleNotifyUserInfo* info, gboolean full )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
335 {
33831
d160ede64878 MXit: Whitespace changes for coding-style consistency.
Andrew Victor <andrew.victor@mxit.com>
parents: 33829
diff changeset
336 struct contact* contact = purple_buddy_get_protocol_data( buddy );
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
337
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
338 if ( !contact )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
339 return;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
340
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
341 /* status (reference: "libpurple/notify.h") */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
342 if ( contact->presence != MXIT_PRESENCE_OFFLINE )
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32186
diff changeset
343 purple_notify_user_info_add_pair_plaintext( info, _( "Status" ), mxit_convert_presence_to_name( contact->presence ) );
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
344
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
345 /* status message */
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32186
diff changeset
346 if ( contact->statusMsg ) {
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32186
diff changeset
347 /* TODO: Check whether it's correct to call add_pair_html,
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32186
diff changeset
348 or if we should be using add_pair_plaintext */
32191
a4668d9dc8d1 Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents: 32188
diff changeset
349 purple_notify_user_info_add_pair_html( info, _( "Status Message" ), contact->statusMsg );
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32186
diff changeset
350 }
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
351
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
352 /* mood */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
353 if ( contact->mood != MXIT_MOOD_NONE )
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32186
diff changeset
354 purple_notify_user_info_add_pair_plaintext( info, _( "Mood" ), mxit_convert_mood_to_name( contact->mood ) );
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
355
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
356 /* subscription type */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
357 if ( contact->subtype != 0 )
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32186
diff changeset
358 purple_notify_user_info_add_pair_plaintext( info, _( "Subscription" ), mxit_convert_subtype_to_name( contact->subtype ) );
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
359
30214
4425992b8c92 * Separate the ClientVersion from the supported ProtocolVersion.
Andrew Victor <andrew.victor@mxit.com>
parents: 30211
diff changeset
360 /* rejection message */
4425992b8c92 * Separate the ClientVersion from the supported ProtocolVersion.
Andrew Victor <andrew.victor@mxit.com>
parents: 30211
diff changeset
361 if ( ( contact->subtype == MXIT_SUBTYPE_REJECTED ) && ( contact->msg != NULL ) )
32211
b46aa64aa1fb These should be using purple_notify_user_info_add_pair_plaintext().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
362 purple_notify_user_info_add_pair_plaintext( info, _( "Rejection Message" ), contact->msg );
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
363 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
364
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
365
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
366 /*------------------------------------------------------------------------
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
367 * Initiate the logout sequence, close the connection and clear the session data.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
368 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
369 * @param gc The connection object
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
370 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
371 static void mxit_close( PurpleConnection* gc )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
372 {
33829
837d3061532b MXit: Use the accessor functions were available.
Andrew Victor <andrew.victor@mxit.com>
parents: 33718
diff changeset
373 struct MXitSession* session = purple_connection_get_protocol_data( gc );
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
374
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
375 /* disable signals */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
376 mxit_disable_signals( session );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
377
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
378 /* close the connection */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
379 mxit_close_connection( session );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
380
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
381 #ifdef MXIT_LINK_CLICK
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
382 /* unregister for uri click notification */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
383 mxit_unregister_uri_handler();
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
384 #endif
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
385
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
386 purple_debug_info( MXIT_PLUGIN_ID, "Releasing the session object..\n" );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
387
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
388 /* free the session memory */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
389 g_free( session );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
390 session = NULL;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
391 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
392
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
393
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
394 /*------------------------------------------------------------------------
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
395 * Send a message to a contact
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
396 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
397 * @param gc The connection object
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
398 * @param who The username of the recipient
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
399 * @param message The message text
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
400 * @param flags Message flags (defined in conversation.h)
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
401 * @return Positive value (success, and echo to conversation window)
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
402 Zero (success, no echo)
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
403 Negative value (error)
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
404 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
405 static int mxit_send_im( PurpleConnection* gc, const char* who, const char* message, PurpleMessageFlags flags )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
406 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
407 purple_debug_info( MXIT_PLUGIN_ID, "Sending message '%s' to buddy '%s'\n", message, who );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
408
33829
837d3061532b MXit: Use the accessor functions were available.
Andrew Victor <andrew.victor@mxit.com>
parents: 33718
diff changeset
409 mxit_send_message( purple_connection_get_protocol_data( gc ), who, message, TRUE, FALSE );
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
410
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
411 return 1; /* echo to conversation window */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
412 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
413
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
414
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
415 /*------------------------------------------------------------------------
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
416 * The user changed their current presence state.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
417 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
418 * @param account The MXit account object
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
419 * @param status The new status (libPurple status type)
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
420 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
421 static void mxit_set_status( PurpleAccount* account, PurpleStatus* status )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
422 {
33829
837d3061532b MXit: Use the accessor functions were available.
Andrew Victor <andrew.victor@mxit.com>
parents: 33718
diff changeset
423 struct MXitSession* session = purple_connection_get_protocol_data( purple_account_get_connection( account ) );
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
424 const char* statusid;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
425 int presence;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
426 char* statusmsg1;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
427 char* statusmsg2;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
428
30176
b380932e86ea Add support for the standard Mood API.
Andrew Victor <andrew.victor@mxit.com>
parents: 30138
diff changeset
429 /* Handle mood changes */
34855
9c289149eed4 Global replaces according to GObject status API
Ankit Vani <a@nevitus.org>
parents: 34728
diff changeset
430 if ( purple_status_type_get_primitive( purple_status_get_status_type( status ) ) == PURPLE_STATUS_MOOD ) {
30176
b380932e86ea Add support for the standard Mood API.
Andrew Victor <andrew.victor@mxit.com>
parents: 30138
diff changeset
431 const char* moodid = purple_status_get_attr_string( status, PURPLE_MOOD_NAME );
b380932e86ea Add support for the standard Mood API.
Andrew Victor <andrew.victor@mxit.com>
parents: 30138
diff changeset
432 int mood;
b380932e86ea Add support for the standard Mood API.
Andrew Victor <andrew.victor@mxit.com>
parents: 30138
diff changeset
433
b380932e86ea Add support for the standard Mood API.
Andrew Victor <andrew.victor@mxit.com>
parents: 30138
diff changeset
434 /* convert the purple mood to a mxit mood */
b380932e86ea Add support for the standard Mood API.
Andrew Victor <andrew.victor@mxit.com>
parents: 30138
diff changeset
435 mood = mxit_convert_mood( moodid );
b380932e86ea Add support for the standard Mood API.
Andrew Victor <andrew.victor@mxit.com>
parents: 30138
diff changeset
436 if ( mood < 0 ) {
b380932e86ea Add support for the standard Mood API.
Andrew Victor <andrew.victor@mxit.com>
parents: 30138
diff changeset
437 /* error, mood not found */
b380932e86ea Add support for the standard Mood API.
Andrew Victor <andrew.victor@mxit.com>
parents: 30138
diff changeset
438 purple_debug_info( MXIT_PLUGIN_ID, "Mood status NOT found! (id = %s)\n", moodid );
b380932e86ea Add support for the standard Mood API.
Andrew Victor <andrew.victor@mxit.com>
parents: 30138
diff changeset
439 return;
b380932e86ea Add support for the standard Mood API.
Andrew Victor <andrew.victor@mxit.com>
parents: 30138
diff changeset
440 }
b380932e86ea Add support for the standard Mood API.
Andrew Victor <andrew.victor@mxit.com>
parents: 30138
diff changeset
441
30177
cdc2a99553b9 Remove the MXit-specific Mood management code. We now use the libpurple Mood (Status) API.
Andrew Victor <andrew.victor@mxit.com>
parents: 30176
diff changeset
442 /* update mood state */
30176
b380932e86ea Add support for the standard Mood API.
Andrew Victor <andrew.victor@mxit.com>
parents: 30138
diff changeset
443 mxit_send_mood( session, mood );
b380932e86ea Add support for the standard Mood API.
Andrew Victor <andrew.victor@mxit.com>
parents: 30138
diff changeset
444 return;
b380932e86ea Add support for the standard Mood API.
Andrew Victor <andrew.victor@mxit.com>
parents: 30138
diff changeset
445 }
b380932e86ea Add support for the standard Mood API.
Andrew Victor <andrew.victor@mxit.com>
parents: 30138
diff changeset
446
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
447 /* get the status id (reference: "libpurple/status.h") */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
448 statusid = purple_status_get_id( status );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
449
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
450 /* convert the purple status to a mxit status */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
451 presence = mxit_convert_presence( statusid );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
452 if ( presence < 0 ) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
453 /* error, status not found */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
454 purple_debug_info( MXIT_PLUGIN_ID, "Presence status NOT found! (id = %s)\n", statusid );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
455 return;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
456 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
457
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
458 statusmsg1 = purple_markup_strip_html( purple_status_get_attr_string( status, "message" ) );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
459 statusmsg2 = g_strndup( statusmsg1, CP_MAX_STATUS_MSG );
29216
9284748dd744 Add extra parameter to mxit_send_message() function to indicate if the message should be
Andrew Victor <andrew.victor@mxit.com>
parents: 29162
diff changeset
460
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
461 purple_debug_info( MXIT_PLUGIN_ID, "mxit_set_status: '%s'\n", statusmsg2 );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
462
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
463 /* update presence state */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
464 mxit_send_presence( session, presence, statusmsg2 );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
465
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
466 g_free( statusmsg1 );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
467 g_free( statusmsg2 );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
468 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
469
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
470
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
471 /*------------------------------------------------------------------------
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
472 * MXit supports messages to offline contacts.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
473 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
474 * @param buddy The buddy
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
475 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
476 static gboolean mxit_offline_message( const PurpleBuddy *buddy )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
477 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
478 return TRUE;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
479 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
480
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
481
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
482 /*------------------------------------------------------------------------
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
483 * Free the resources used to store a buddy.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
484 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
485 * @param buddy The buddy
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
486 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
487 static void mxit_free_buddy( PurpleBuddy* buddy )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
488 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
489 struct contact* contact;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
490
33831
d160ede64878 MXit: Whitespace changes for coding-style consistency.
Andrew Victor <andrew.victor@mxit.com>
parents: 33829
diff changeset
491 contact = purple_buddy_get_protocol_data( buddy );
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
492 if ( contact ) {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
493 if ( contact->statusMsg )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
494 g_free( contact->statusMsg );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
495 if ( contact->avatarId )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
496 g_free( contact->avatarId );
30214
4425992b8c92 * Separate the ClientVersion from the supported ProtocolVersion.
Andrew Victor <andrew.victor@mxit.com>
parents: 30211
diff changeset
497 if ( contact->msg )
4425992b8c92 * Separate the ClientVersion from the supported ProtocolVersion.
Andrew Victor <andrew.victor@mxit.com>
parents: 30211
diff changeset
498 g_free( contact->msg );
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
499 g_free( contact );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
500 }
29667
9c7cdbf30435 struct hiding updates for mxit
Gary Kramlich <grim@reaperworld.com>
parents: 29106
diff changeset
501
33831
d160ede64878 MXit: Whitespace changes for coding-style consistency.
Andrew Victor <andrew.victor@mxit.com>
parents: 33829
diff changeset
502 purple_buddy_set_protocol_data( buddy, NULL );
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
503 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
504
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
505
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
506 /*------------------------------------------------------------------------
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
507 * Periodic task called every KEEPALIVE_INTERVAL (30 sec) to to maintain
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
508 * idle connections, timeouts and the transmission queue to the MXit server.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
509 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
510 * @param gc The connection object
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
511 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
512 static void mxit_keepalive( PurpleConnection *gc )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
513 {
33829
837d3061532b MXit: Use the accessor functions were available.
Andrew Victor <andrew.victor@mxit.com>
parents: 33718
diff changeset
514 struct MXitSession* session = purple_connection_get_protocol_data( gc );
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
515
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
516 /* if not logged in, there is nothing to do */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
517 if ( !( session->flags & MXIT_FLAG_LOGGEDIN ) )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
518 return;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
519
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
520 /* pinging is only for socket connections (HTTP does polling) */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
521 if ( session->http )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
522 return;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
523
31501
4a96cf0f177a * do not send requests too fast to the mxit server or they will start ignoring you.
Pieter Loubser <pieter.loubser@mxit.com>
parents: 31498
diff changeset
524 if ( session->last_tx <= ( mxit_now_milli() - ( MXIT_PING_INTERVAL * 1000 ) ) ) {
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
525 /*
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
526 * this connection has been idle for too long, better ping
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
527 * the server before it kills our connection.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
528 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
529 mxit_send_ping( session );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
530 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
531 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
532
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
533
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
534 /*------------------------------------------------------------------------
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
535 * Set or clear our Buddy icon.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
536 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
537 * @param gc The connection object
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
538 * @param img The buddy icon data
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
539 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
540 static void mxit_set_buddy_icon( PurpleConnection *gc, PurpleStoredImage *img )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
541 {
33829
837d3061532b MXit: Use the accessor functions were available.
Andrew Victor <andrew.victor@mxit.com>
parents: 33718
diff changeset
542 struct MXitSession* session = purple_connection_get_protocol_data( gc );
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
543
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
544 if ( img == NULL )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
545 mxit_set_avatar( session, NULL, 0 );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
546 else
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
547 mxit_set_avatar( session, purple_imgstore_get_data( img ), purple_imgstore_get_size( img ) );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
548 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
549
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
550
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
551 /*------------------------------------------------------------------------
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
552 * Request profile information for another MXit contact.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
553 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
554 * @param gc The connection object
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30523
diff changeset
555 * @param who The username of the contact.
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
556 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
557 static void mxit_get_info( PurpleConnection *gc, const char *who )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
558 {
31502
721da633f8fb Only MXit users have profiles, so display a better message when "Get Info" is selected for non-users.
Andrew Victor <andrew.victor@mxit.com>
parents: 31501
diff changeset
559 PurpleBuddy* buddy;
721da633f8fb Only MXit users have profiles, so display a better message when "Get Info" is selected for non-users.
Andrew Victor <andrew.victor@mxit.com>
parents: 31501
diff changeset
560 struct contact* contact;
33829
837d3061532b MXit: Use the accessor functions were available.
Andrew Victor <andrew.victor@mxit.com>
parents: 33718
diff changeset
561 struct MXitSession* session = purple_connection_get_protocol_data( gc );
30211
6c81374b615e * Show the buddy's registration country in their profile.
Andrew Victor <andrew.victor@mxit.com>
parents: 30209
diff changeset
562 const char* profilelist[] = { CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_FULLNAME,
30519
de9e72446479 A few changes to the Profile.
Andrew Victor <andrew.victor@mxit.com>
parents: 30371
diff changeset
563 CP_PROFILE_FIRSTNAME, CP_PROFILE_LASTNAME, CP_PROFILE_REGCOUNTRY, CP_PROFILE_LASTSEEN,
33555
8feb2763abe9 MXit: Add support for the Relationship Status profile attribute.
Andrew Victor <andrew.victor@mxit.com>
parents: 33554
diff changeset
564 CP_PROFILE_STATUS, CP_PROFILE_AVATAR, CP_PROFILE_WHEREAMI, CP_PROFILE_ABOUTME, CP_PROFILE_RELATIONSHIP };
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
565
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
566 purple_debug_info( MXIT_PLUGIN_ID, "mxit_get_info: '%s'\n", who );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
567
34706
02cb08146888 Renamed blist.[ch] to buddylist.[ch]
Ankit Vani <a@nevitus.org>
parents: 34699
diff changeset
568 /* find the buddy information for this contact (reference: "libpurple/buddylist.h") */
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34706
diff changeset
569 buddy = purple_blist_find_buddy( session->acc, who );
31713
d90486295afa The mini-dialogs feature now allows you to request profile information for
Andrew Victor <andrew.victor@mxit.com>
parents: 31703
diff changeset
570 if ( buddy ) {
d90486295afa The mini-dialogs feature now allows you to request profile information for
Andrew Victor <andrew.victor@mxit.com>
parents: 31703
diff changeset
571 /* user is in our contact-list, so it's not an invite */
d90486295afa The mini-dialogs feature now allows you to request profile information for
Andrew Victor <andrew.victor@mxit.com>
parents: 31703
diff changeset
572 contact = purple_buddy_get_protocol_data( buddy );
d90486295afa The mini-dialogs feature now allows you to request profile information for
Andrew Victor <andrew.victor@mxit.com>
parents: 31703
diff changeset
573 if ( !contact )
d90486295afa The mini-dialogs feature now allows you to request profile information for
Andrew Victor <andrew.victor@mxit.com>
parents: 31703
diff changeset
574 return;
31502
721da633f8fb Only MXit users have profiles, so display a better message when "Get Info" is selected for non-users.
Andrew Victor <andrew.victor@mxit.com>
parents: 31501
diff changeset
575
31713
d90486295afa The mini-dialogs feature now allows you to request profile information for
Andrew Victor <andrew.victor@mxit.com>
parents: 31703
diff changeset
576 /* only MXit users have profiles */
d90486295afa The mini-dialogs feature now allows you to request profile information for
Andrew Victor <andrew.victor@mxit.com>
parents: 31703
diff changeset
577 if ( contact->type != MXIT_TYPE_MXIT ) {
d90486295afa The mini-dialogs feature now allows you to request profile information for
Andrew Victor <andrew.victor@mxit.com>
parents: 31703
diff changeset
578 mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "No profile available" ), _( "This contact does not have a profile." ) );
d90486295afa The mini-dialogs feature now allows you to request profile information for
Andrew Victor <andrew.victor@mxit.com>
parents: 31703
diff changeset
579 return;
d90486295afa The mini-dialogs feature now allows you to request profile information for
Andrew Victor <andrew.victor@mxit.com>
parents: 31703
diff changeset
580 }
31502
721da633f8fb Only MXit users have profiles, so display a better message when "Get Info" is selected for non-users.
Andrew Victor <andrew.victor@mxit.com>
parents: 31501
diff changeset
581 }
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
582
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
583 /* send profile request */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
584 mxit_send_extprofile_request( session, who, ARRAY_SIZE( profilelist ), profilelist );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
585 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
586
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
587
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
588 /*------------------------------------------------------------------------
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
589 * Return a list of labels to be used by Pidgin for assisting the user.
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
590 */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
591 static GHashTable* mxit_get_text_table( PurpleAccount* acc )
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
592 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
593 GHashTable* table;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
594
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
595 table = g_hash_table_new( g_str_hash, g_str_equal );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
596
30371
a307496582ab Implemented new naming conventions
Pieter Loubser <pieter.loubser@mxit.com>
parents: 30310
diff changeset
597 g_hash_table_insert( table, "login_label", (gpointer)_( "Your MXit ID..." ) );
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
598
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
599 return table;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
600 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
601
30519
de9e72446479 A few changes to the Profile.
Andrew Victor <andrew.victor@mxit.com>
parents: 30371
diff changeset
602
de9e72446479 A few changes to the Profile.
Andrew Victor <andrew.victor@mxit.com>
parents: 30371
diff changeset
603 /*------------------------------------------------------------------------
30576
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
604 * Re-Invite was selected from the buddy-list menu.
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
605 *
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
606 * @param node The entry in the buddy list.
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
607 * @param ignored (not used)
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
608 */
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
609 static void mxit_reinvite( PurpleBlistNode *node, gpointer ignored )
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
610 {
33829
837d3061532b MXit: Use the accessor functions were available.
Andrew Victor <andrew.victor@mxit.com>
parents: 33718
diff changeset
611 PurpleBuddy* buddy = (PurpleBuddy *) node;
837d3061532b MXit: Use the accessor functions were available.
Andrew Victor <andrew.victor@mxit.com>
parents: 33718
diff changeset
612 PurpleConnection* gc = purple_account_get_connection( purple_buddy_get_account( buddy ) );
837d3061532b MXit: Use the accessor functions were available.
Andrew Victor <andrew.victor@mxit.com>
parents: 33718
diff changeset
613 struct MXitSession* session = purple_connection_get_protocol_data( gc );
30576
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
614 struct contact* contact;
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
615
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
616 contact = purple_buddy_get_protocol_data( (PurpleBuddy*) node );
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
617 if ( !contact )
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
618 return;
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
619
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
620 /* send a new invite */
31720
4047faf09005 Protocol 6.3 change to SubscribeContact packet.
Andrew Victor <andrew.victor@mxit.com>
parents: 31713
diff changeset
621 mxit_send_invite( session, contact->username, TRUE, contact->alias, contact->groupname, NULL );
30576
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
622 }
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
623
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
624
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
625 /*------------------------------------------------------------------------
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
626 * Buddy-list menu.
30519
de9e72446479 A few changes to the Profile.
Andrew Victor <andrew.victor@mxit.com>
parents: 30371
diff changeset
627 *
de9e72446479 A few changes to the Profile.
Andrew Victor <andrew.victor@mxit.com>
parents: 30371
diff changeset
628 * @param node The entry in the buddy list.
de9e72446479 A few changes to the Profile.
Andrew Victor <andrew.victor@mxit.com>
parents: 30371
diff changeset
629 */
de9e72446479 A few changes to the Profile.
Andrew Victor <andrew.victor@mxit.com>
parents: 30371
diff changeset
630 static GList* mxit_blist_menu( PurpleBlistNode *node )
de9e72446479 A few changes to the Profile.
Andrew Victor <andrew.victor@mxit.com>
parents: 30371
diff changeset
631 {
de9e72446479 A few changes to the Profile.
Andrew Victor <andrew.victor@mxit.com>
parents: 30371
diff changeset
632 PurpleBuddy* buddy;
de9e72446479 A few changes to the Profile.
Andrew Victor <andrew.victor@mxit.com>
parents: 30371
diff changeset
633 struct contact* contact;
de9e72446479 A few changes to the Profile.
Andrew Victor <andrew.victor@mxit.com>
parents: 30371
diff changeset
634 GList* m = NULL;
30576
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
635 PurpleMenuAction* act;
30519
de9e72446479 A few changes to the Profile.
Andrew Victor <andrew.victor@mxit.com>
parents: 30371
diff changeset
636
34696
6e0d13978666 Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents: 34670
diff changeset
637 if ( !PURPLE_IS_BUDDY( node ) )
30519
de9e72446479 A few changes to the Profile.
Andrew Victor <andrew.victor@mxit.com>
parents: 30371
diff changeset
638 return NULL;
de9e72446479 A few changes to the Profile.
Andrew Victor <andrew.victor@mxit.com>
parents: 30371
diff changeset
639
de9e72446479 A few changes to the Profile.
Andrew Victor <andrew.victor@mxit.com>
parents: 30371
diff changeset
640 buddy = (PurpleBuddy *) node;
de9e72446479 A few changes to the Profile.
Andrew Victor <andrew.victor@mxit.com>
parents: 30371
diff changeset
641 contact = purple_buddy_get_protocol_data( buddy );
de9e72446479 A few changes to the Profile.
Andrew Victor <andrew.victor@mxit.com>
parents: 30371
diff changeset
642 if ( !contact )
de9e72446479 A few changes to the Profile.
Andrew Victor <andrew.victor@mxit.com>
parents: 30371
diff changeset
643 return NULL;
de9e72446479 A few changes to the Profile.
Andrew Victor <andrew.victor@mxit.com>
parents: 30371
diff changeset
644
30576
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
645 if ( ( contact->subtype == MXIT_SUBTYPE_DELETED ) || ( contact->subtype == MXIT_SUBTYPE_REJECTED ) || ( contact->subtype == MXIT_SUBTYPE_NONE ) ) {
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
646 /* contact is in Deleted, Rejected or None state */
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
647 act = purple_menu_action_new( _( "Re-Invite" ), PURPLE_CALLBACK( mxit_reinvite ), NULL, NULL );
33831
d160ede64878 MXit: Whitespace changes for coding-style consistency.
Andrew Victor <andrew.victor@mxit.com>
parents: 33829
diff changeset
648 m = g_list_append( m, act );
30576
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
649 }
664292162dae Add support for re-inviting contacts in the Deleted or Rejected state.
Andrew Victor <andrew.victor@mxit.com>
parents: 30523
diff changeset
650
30519
de9e72446479 A few changes to the Profile.
Andrew Victor <andrew.victor@mxit.com>
parents: 30371
diff changeset
651 return m;
de9e72446479 A few changes to the Profile.
Andrew Victor <andrew.victor@mxit.com>
parents: 30371
diff changeset
652 }
de9e72446479 A few changes to the Profile.
Andrew Victor <andrew.victor@mxit.com>
parents: 30371
diff changeset
653
33554
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
654
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
655 /*------------------------------------------------------------------------
33613
a3aac6ba27ad MXit: We need to implement a "chat_info_defaults" in the prpl.
Andrew Victor <andrew.victor@mxit.com>
parents: 33611
diff changeset
656 * Return Chat-room default settings.
a3aac6ba27ad MXit: We need to implement a "chat_info_defaults" in the prpl.
Andrew Victor <andrew.victor@mxit.com>
parents: 33611
diff changeset
657 *
a3aac6ba27ad MXit: We need to implement a "chat_info_defaults" in the prpl.
Andrew Victor <andrew.victor@mxit.com>
parents: 33611
diff changeset
658 * @return Chat defaults list
a3aac6ba27ad MXit: We need to implement a "chat_info_defaults" in the prpl.
Andrew Victor <andrew.victor@mxit.com>
parents: 33611
diff changeset
659 */
a3aac6ba27ad MXit: We need to implement a "chat_info_defaults" in the prpl.
Andrew Victor <andrew.victor@mxit.com>
parents: 33611
diff changeset
660 static GHashTable *mxit_chat_info_defaults( PurpleConnection *gc, const char *chat_name )
a3aac6ba27ad MXit: We need to implement a "chat_info_defaults" in the prpl.
Andrew Victor <andrew.victor@mxit.com>
parents: 33611
diff changeset
661 {
a3aac6ba27ad MXit: We need to implement a "chat_info_defaults" in the prpl.
Andrew Victor <andrew.victor@mxit.com>
parents: 33611
diff changeset
662 return g_hash_table_new_full( g_str_hash, g_str_equal, NULL, g_free );
a3aac6ba27ad MXit: We need to implement a "chat_info_defaults" in the prpl.
Andrew Victor <andrew.victor@mxit.com>
parents: 33611
diff changeset
663 }
a3aac6ba27ad MXit: We need to implement a "chat_info_defaults" in the prpl.
Andrew Victor <andrew.victor@mxit.com>
parents: 33611
diff changeset
664
a3aac6ba27ad MXit: We need to implement a "chat_info_defaults" in the prpl.
Andrew Victor <andrew.victor@mxit.com>
parents: 33611
diff changeset
665
a3aac6ba27ad MXit: We need to implement a "chat_info_defaults" in the prpl.
Andrew Victor <andrew.victor@mxit.com>
parents: 33611
diff changeset
666 /*------------------------------------------------------------------------
33554
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
667 * Send a typing indicator event.
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
668 *
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
669 * @param gc The connection object
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
670 * @param name The username of the contact
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
671 * @param state The typing state to be reported.
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
672 */
34670
9bd5bd903dc7 Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents: 34637
diff changeset
673 static unsigned int mxit_send_typing( PurpleConnection *gc, const char *name, PurpleIMTypingState state )
33554
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
674 {
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
675 PurpleAccount* account = purple_connection_get_account( gc );
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
676 struct MXitSession* session = purple_connection_get_protocol_data( gc );
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
677 PurpleBuddy* buddy;
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
678 struct contact* contact;
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
679 gchar* messageId = NULL;
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
680
34706
02cb08146888 Renamed blist.[ch] to buddylist.[ch]
Ankit Vani <a@nevitus.org>
parents: 34699
diff changeset
681 /* find the buddy information for this contact (reference: "libpurple/buddylist.h") */
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34706
diff changeset
682 buddy = purple_blist_find_buddy( account, name );
33554
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
683 if ( !buddy ) {
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
684 purple_debug_warning( MXIT_PLUGIN_ID, "mxit_send_typing: unable to find the buddy '%s'\n", name );
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
685 return 0;
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
686 }
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
687
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
688 contact = purple_buddy_get_protocol_data( buddy );
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
689 if ( !contact )
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
690 return 0;
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
691
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
692 /* does this contact support and want typing notification? */
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
693 if ( ! ( contact->capabilities & MXIT_PFLAG_TYPING ) )
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
694 return 0;
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
695
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
696 messageId = purple_uuid_random(); /* generate a unique message id */
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
697
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
698 switch ( state ) {
34670
9bd5bd903dc7 Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents: 34637
diff changeset
699 case PURPLE_IM_TYPING : /* currently typing */
33554
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
700 mxit_send_msgevent( session, name, messageId, CP_MSGEVENT_TYPING );
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
701 break;
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
702
34670
9bd5bd903dc7 Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents: 34637
diff changeset
703 case PURPLE_IM_TYPED : /* stopped typing */
9bd5bd903dc7 Renamed chat buddies to chat users, and IM conversation typing state to IM typing state.
Ankit Vani <a@nevitus.org>
parents: 34637
diff changeset
704 case PURPLE_IM_NOT_TYPING : /* not typing / erased all text */
33554
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
705 mxit_send_msgevent( session, name, messageId, CP_MSGEVENT_STOPPED );
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
706 break;
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
707
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
708 default:
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
709 break;
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
710 }
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
711
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
712 g_free( messageId );
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
713
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
714 return 0;
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
715 }
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
716
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
717
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
718 /*========================================================================================================================*/
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
719
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36542
diff changeset
720 static PurpleProtocol proto_info = {
36524
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
721 MXIT_PLUGIN_ID, /* protocol id (must be unique) */
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
722 MXIT_PLUGIN_NAME, /* protocol name (this will be displayed in the UI) */
36544
1bf8b6ef5aea Renamed PurplePluginProtocolInfo to PurpleProtocol
Ankit Vani <a@nevitus.org>
parents: 36542
diff changeset
723 sizeof( PurpleProtocol ), /* struct_size */
33711
909bc3642565 MXit: Enable support for sending a rejection messages when denying an invite request.
Andrew Victor <andrew.victor@mxit.com>
parents: 33648
diff changeset
724 OPT_PROTO_REGISTER_NOSCREENNAME | OPT_PROTO_UNIQUE_CHATNAME | OPT_PROTO_IM_IMAGE | OPT_PROTO_INVITE_MESSAGE | OPT_PROTO_AUTHORIZATION_DENIED_MESSAGE, /* options */
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
725 NULL, /* user_splits */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
726 NULL, /* protocol_options */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
727 { /* icon_spec */
33718
cac9a5d4fe33 MXit: Don't limit the uploaded avatar image to 96x96.
Andrew Victor <andrew.victor@mxit.com>
parents: 33617
diff changeset
728 "png,jpeg,bmp", /* supported formats */
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
729 32, 32, /* min width & height */
33718
cac9a5d4fe33 MXit: Don't limit the uploaded avatar image to 96x96.
Andrew Victor <andrew.victor@mxit.com>
parents: 33617
diff changeset
730 800, 800, /* max width & height */
cac9a5d4fe33 MXit: Don't limit the uploaded avatar image to 96x96.
Andrew Victor <andrew.victor@mxit.com>
parents: 33617
diff changeset
731 CP_MAX_FILESIZE, /* max filesize */
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
732 PURPLE_ICON_SCALE_SEND | PURPLE_ICON_SCALE_DISPLAY /* scaling rules */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
733 },
36524
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
734 mxit_get_actions, /* get_actions [actions.c] */
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
735 mxit_list_icon, /* list_icon */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
736 mxit_list_emblem, /* list_emblem */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
737 mxit_status_text, /* status_text */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
738 mxit_tooltip, /* tooltip_text */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
739 mxit_status_types, /* status types [roster.c] */
30519
de9e72446479 A few changes to the Profile.
Andrew Victor <andrew.victor@mxit.com>
parents: 30371
diff changeset
740 mxit_blist_menu, /* blist_node_menu */
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
741 mxit_chat_info, /* chat_info [multimx.c] */
33613
a3aac6ba27ad MXit: We need to implement a "chat_info_defaults" in the prpl.
Andrew Victor <andrew.victor@mxit.com>
parents: 33611
diff changeset
742 mxit_chat_info_defaults,/* chat_info_defaults */
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
743 mxit_login, /* login [login.c] */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
744 mxit_close, /* close */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
745 mxit_send_im, /* send_im */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
746 NULL, /* set_info */
33554
4a87c767a037 MXit: Add support for typing notification.
Andrew Victor <andrew.victor@mxit.com>
parents: 31720
diff changeset
747 mxit_send_typing, /* send_typing */
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
748 mxit_get_info, /* get_info */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
749 mxit_set_status, /* set_status */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
750 NULL, /* set_idle */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
751 NULL, /* change_passwd */
32315
2550a39e0285 Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32219
diff changeset
752 mxit_add_buddy, /* add_buddy [roster.c] */
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
753 NULL, /* add_buddies */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
754 mxit_remove_buddy, /* remove_buddy [roster.c] */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
755 NULL, /* remove_buddies */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
756 NULL, /* add_permit */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
757 NULL, /* add_deny */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
758 NULL, /* rem_permit */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
759 NULL, /* rem_deny */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
760 NULL, /* set_permit_deny */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
761 mxit_chat_join, /* join_chat [multimx.c] */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
762 mxit_chat_reject, /* reject chat invite [multimx.c] */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
763 mxit_chat_name, /* get_chat_name [multimx.c] */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
764 mxit_chat_invite, /* chat_invite [multimx.c] */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
765 mxit_chat_leave, /* chat_leave [multimx.c] */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
766 NULL, /* chat_whisper */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
767 mxit_chat_send, /* chat_send [multimx.c] */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
768 mxit_keepalive, /* keepalive */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
769 mxit_register, /* register_user */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
770 NULL, /* get_cb_info */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
771 mxit_buddy_alias, /* alias_buddy [roster.c] */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
772 mxit_buddy_group, /* group_buddy [roster.c] */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
773 mxit_rename_group, /* rename_group [roster.c] */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
774 mxit_free_buddy, /* buddy_free */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
775 NULL, /* convo_closed */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
776 NULL, /* normalize */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
777 mxit_set_buddy_icon, /* set_buddy_icon */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
778 NULL, /* remove_group */ // TODO: Add function to move all contacts out of this group (cmd=30 - remove group)?
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
779 NULL, /* get_cb_real_name */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
780 NULL, /* set_chat_topic */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
781 NULL, /* find_blist_chat */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
782 NULL, /* roomlist_get_list */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
783 NULL, /* roomlist_cancel */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
784 NULL, /* roomlist_expand_category */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
785 mxit_xfer_enabled, /* can_receive_file [filexfer.c] */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
786 mxit_xfer_tx, /* send_file [filexfer.c */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
787 mxit_xfer_new, /* new_xfer [filexfer.c] */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
788 mxit_offline_message, /* offline_message */
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
789 NULL, /* whiteboard_protocol_ops */
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
790 NULL, /* send_raw */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
791 NULL, /* roomlist_room_serialize */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
792 NULL, /* unregister_user */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
793 NULL, /* send_attention */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
794 NULL, /* attention_types */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
795 mxit_get_text_table, /* get_account_text_table */
31491
cf74b88370ea The initial protocol infrastructure for MXit Voice/Video support.
Andrew Victor <andrew.victor@mxit.com>
parents: 31490
diff changeset
796 mxit_media_initiate, /* initiate_media */
cf74b88370ea The initial protocol infrastructure for MXit Voice/Video support.
Andrew Victor <andrew.victor@mxit.com>
parents: 31490
diff changeset
797 mxit_media_caps, /* get_media_caps */
30176
b380932e86ea Add support for the standard Mood API.
Andrew Victor <andrew.victor@mxit.com>
parents: 30138
diff changeset
798 mxit_get_moods, /* get_moods */
30138
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 29757
diff changeset
799 NULL, /* set_public_alias */
34312
4461d5c1e61c Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34297
diff changeset
800 NULL, /* get_public_alias */
4461d5c1e61c Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34297
diff changeset
801 NULL /* get_max_message_size */
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
802 };
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
803
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
804
36524
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
805 /*------------------------------------------------------------------------
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
806 * Querying the MXit plugin.
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
807 *
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
808 * @param error Query error (if any)
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
809 */
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
810 static PurplePluginInfo *plugin_query( GError **error )
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
811 {
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
812 return purple_plugin_info_new(
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
813 "id", MXIT_PLUGIN_ID, /* plugin id (must be unique) */
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
814 "name", MXIT_PLUGIN_NAME, /* plugin name (this will be displayed in the UI) */
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
815 "version", DISPLAY_VERSION, /* version of the plugin */
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
816 "category", MXIT_PLUGIN_CATEGORY, /* category of the plugin */
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
817 "summary", MXIT_PLUGIN_SUMMARY, /* short summary of the plugin */
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
818 "description", MXIT_PLUGIN_DESC, /* description of the plugin (can be long) */
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
819 "author", MXIT_PLUGIN_AUTHOR, /* plugin author name and email address */
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
820 "website", MXIT_PLUGIN_WWW, /* plugin website (to find new versions and reporting of bugs) */
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
821 "abi-version", PURPLE_ABI_VERSION, /* ABI version required by the plugin */
36536
07f8c9889257 Added flags to all prpls
Ankit Vani <a@nevitus.org>
parents: 36524
diff changeset
822 "flags", GPLUGIN_PLUGIN_INFO_FLAGS_INTERNAL |
07f8c9889257 Added flags to all prpls
Ankit Vani <a@nevitus.org>
parents: 36524
diff changeset
823 GPLUGIN_PLUGIN_INFO_FLAGS_LOAD_ON_QUERY,
36524
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
824 NULL
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
825 );
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
826 }
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
827
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
828
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
829 /*------------------------------------------------------------------------
36524
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
830 * Loading the MXit plugin.
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
831 *
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
832 * @param plugin The plugin object
36524
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
833 * @param error Load error (if any)
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
834 */
36524
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
835 static gboolean plugin_load( PurplePlugin* plugin, GError **error )
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
836 {
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
837 PurpleAccountOption* option;
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
838
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
839 /* Configuration options */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
840
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
841 /* WAP server (reference: "libpurple/accountopt.h") */
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
842 option = purple_account_option_string_new( _( "WAP Server" ), MXIT_CONFIG_WAPSERVER, DEFAULT_WAPSITE );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
843 proto_info.protocol_options = g_list_append( proto_info.protocol_options, option );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
844
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
845 option = purple_account_option_bool_new( _( "Connect via HTTP" ), MXIT_CONFIG_USE_HTTP, FALSE );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
846 proto_info.protocol_options = g_list_append( proto_info.protocol_options, option );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
847
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
848 option = purple_account_option_bool_new( _( "Enable splash-screen popup" ), MXIT_CONFIG_SPLASHPOPUP, FALSE );
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
849 proto_info.protocol_options = g_list_append( proto_info.protocol_options, option );
36524
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
850
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
851 purple_protocols_add( &proto_info );
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
852
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
853 return TRUE;
28841
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
854 }
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
855
6b9568572bcb Initial addition of the MXit protocol plugin, provided by the MXit folks
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff changeset
856
36524
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
857 /*------------------------------------------------------------------------
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
858 * Unloading the MXit plugin.
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
859 *
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
860 * @param plugin The plugin object
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
861 * @param error Unload error (if any)
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
862 */
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
863 static gboolean plugin_unload( PurplePlugin* plugin, GError **error )
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
864 {
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
865 purple_protocols_remove( &proto_info );
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
866
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
867 return TRUE;
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
868 }
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
869
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
870 PURPLE_PLUGIN_INIT( mxit, plugin_query, plugin_load, plugin_unload );
9da9eeae0cc4 Refactored mxit to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
871

mercurial