annotate libpurple/protocols/myspace/myspace.h @ 17968:a2298513db8b

Move msim_escape() and msim_unescape() to message.c.
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Sun, 22 Jul 2007 07:00:10 +0000
parents c9acdf96e74e
children 8983b8340fdc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17286
58b4d103a5b8 Use symbolic constants for persist messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17280
diff changeset
1 /* MySpaceIM Protocol Plugin, header file
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
2 *
17680
d87916bd1d73 Fix email address.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17679
diff changeset
3 * Copyright (C) 2007, Jeff Connelly <jeff2@soc.pidgin.im>
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
4 *
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
7 * the Free Software Foundation; either version 2 of the License, or
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
8 * (at your option) any later version.
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
9 *
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
13 * GNU General Public License for more details.
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
14 *
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
16 * along with this program; if not, write to the Free Software
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
18 */
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
19
16735
52357f6392a4 Add partial implementation of MsimMessage (not used anywhere yet).
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16734
diff changeset
20 #ifndef _MYSPACE_MYSPACE_H
52357f6392a4 Add partial implementation of MsimMessage (not used anywhere yet).
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16734
diff changeset
21 #define _MYSPACE_MYSPACE_H
52357f6392a4 Add partial implementation of MsimMessage (not used anywhere yet).
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16734
diff changeset
22
16736
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
23 /* Other includes */
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
24 #include <string.h>
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
25 #include <errno.h> /* for EAGAIN */
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
26 #include <stdarg.h>
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
27
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
28 #include <glib.h>
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
29
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
30 #ifdef _WIN32
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
31 #include "win32dep.h"
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
32 #else
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
33 /* For recv() and send(); needed to match Win32 */
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
34 #include <sys/types.h>
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
35 #include <sys/socket.h>
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
36 #endif
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
37
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
38 #include "internal.h"
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
39
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
40 #include "notify.h"
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
41 #include "plugin.h"
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
42 #include "accountopt.h"
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
43 #include "version.h"
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
44 #include "cipher.h" /* for SHA-1 */
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
45 #include "util.h" /* for base64 */
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
46 #include "debug.h" /* for purple_debug_info */
17662
7b890c79aabf Add msim_markup_to_html() to convert MySpaceIM-style markup to Purple-compatible
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17660
diff changeset
47 #include "xmlnode.h"
16736
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
48
17266
793301c04e3a (Incomplete - plugin does not load) Begin migrating protocol message receiving to MsimMessage.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16738
diff changeset
49 /* MySpaceIM includes */
793301c04e3a (Incomplete - plugin does not load) Begin migrating protocol message receiving to MsimMessage.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16738
diff changeset
50 #include "message.h"
793301c04e3a (Incomplete - plugin does not load) Begin migrating protocol message receiving to MsimMessage.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16738
diff changeset
51
16725
58cd11fcd84f Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16723
diff changeset
52 /* Conditional compilation options */
58cd11fcd84f Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16723
diff changeset
53
58cd11fcd84f Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16723
diff changeset
54 /* Debugging options */
58cd11fcd84f Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16723
diff changeset
55 #define MSIM_DEBUG_MSG
16407
bb649c52fc19 Replace printf() in MySpaceIM prpl with purple_debug_info().
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16405
diff changeset
56 /* Low-level and rarely needed */
16725
58cd11fcd84f Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16723
diff changeset
57 /*#define MSIM_DEBUG_PARSE */
58cd11fcd84f Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16723
diff changeset
58 /*#define MSIM_DEBUG_LOGIN_CHALLENGE */
58cd11fcd84f Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16723
diff changeset
59 /*#define MSIM_DEBUG_RXBUF */
58cd11fcd84f Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16723
diff changeset
60
17651
333fe6ac1046 Add msim_unrecognized() to handle unhandled messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17649
diff changeset
61 /* Define to cause init_plugin() to run some tests and print
333fe6ac1046 Add msim_unrecognized() to handle unhandled messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17649
diff changeset
62 * the results to the Purple debug log, then exit. Useful to
333fe6ac1046 Add msim_unrecognized() to handle unhandled messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17649
diff changeset
63 * run with 'pidgin -d' to see the output. Don't define if
333fe6ac1046 Add msim_unrecognized() to handle unhandled messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17649
diff changeset
64 * you want to actually use the plugin! */
333fe6ac1046 Add msim_unrecognized() to handle unhandled messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17649
diff changeset
65 /*#define MSIM_SELF_TEST */
333fe6ac1046 Add msim_unrecognized() to handle unhandled messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17649
diff changeset
66
16725
58cd11fcd84f Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16723
diff changeset
67 /* Constants */
16407
bb649c52fc19 Replace printf() in MySpaceIM prpl with purple_debug_info().
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16405
diff changeset
68
17684
e440846f9a21 Increase password length limit to 10 and update changes file.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17683
diff changeset
69 /* Maximum length of a password that is acceptable. This is the limit
e440846f9a21 Increase password length limit to 10 and update changes file.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17683
diff changeset
70 * on the official client (build 679) and on the 'new password' field at
e440846f9a21 Increase password length limit to 10 and update changes file.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17683
diff changeset
71 * http://settings.myspace.com/index.cfm?fuseaction=user.changepassword
e440846f9a21 Increase password length limit to 10 and update changes file.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17683
diff changeset
72 * (though curiously, not on the 'current password' field). */
e440846f9a21 Increase password length limit to 10 and update changes file.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17683
diff changeset
73 #define MSIM_MAX_PASSWORD_LENGTH 10
17665
5c2720824798 Fail with our own error message if an entered password is greater than 8
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17662
diff changeset
74
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
75 /* Build version of MySpaceIM to report to servers (1.0.xxx.0) */
17967
c9acdf96e74e Update login process to more closely match official client.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17966
diff changeset
76 #define MSIM_CLIENT_VERSION 697
c9acdf96e74e Update login process to more closely match official client.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17966
diff changeset
77
c9acdf96e74e Update login process to more closely match official client.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17966
diff changeset
78 /* Language codes from http://www.microsoft.com/globaldev/reference/oslocversion.mspx */
c9acdf96e74e Update login process to more closely match official client.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17966
diff changeset
79 #define MSIM_LANGUAGE_ID_ENGLISH 1033
c9acdf96e74e Update login process to more closely match official client.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17966
diff changeset
80 #define MSIM_LANGUAGE_NAME_ENGLISH "ENGLISH"
17953
bde17299004b Support unofficial bm code 200, also used by Miranda IM plugin, to report
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17952
diff changeset
81
bde17299004b Support unofficial bm code 200, also used by Miranda IM plugin, to report
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17952
diff changeset
82 /* msimprpl version string of this plugin */
bde17299004b Support unofficial bm code 200, also used by Miranda IM plugin, to report
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17952
diff changeset
83 #define MSIM_PRPL_VERSION_STRING "0.12"
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
84
17687
d0c8b7748065 Add msim_check_alive(), called every MSIM_KEEPALIVE_INTERVAL_CHECK milliseconds,
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17686
diff changeset
85 /* Default server */
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
86 #define MSIM_SERVER "im.myspace.akadns.net"
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
87 #define MSIM_PORT 1863 /* TODO: alternate ports and automatic */
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
88
17687
d0c8b7748065 Add msim_check_alive(), called every MSIM_KEEPALIVE_INTERVAL_CHECK milliseconds,
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17686
diff changeset
89 /* Time between keepalives (seconds) - if no data within this time, is dead. */
17692
3aed9c8c6af7 Fix bug where string returned from msim_msg_get_string() is not a new
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17691
diff changeset
90 #define MSIM_KEEPALIVE_INTERVAL (3 * 60)
17687
d0c8b7748065 Add msim_check_alive(), called every MSIM_KEEPALIVE_INTERVAL_CHECK milliseconds,
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17686
diff changeset
91
d0c8b7748065 Add msim_check_alive(), called every MSIM_KEEPALIVE_INTERVAL_CHECK milliseconds,
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17686
diff changeset
92 /* Time to check if alive (milliseconds) */
17690
44de942bd762 Lower timeout to 2 minutes (to be closer to keepalive of 124 s).
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17689
diff changeset
93 #define MSIM_KEEPALIVE_INTERVAL_CHECK (30 * 1000)
17687
d0c8b7748065 Add msim_check_alive(), called every MSIM_KEEPALIVE_INTERVAL_CHECK milliseconds,
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17686
diff changeset
94
17947
ac7066ffa109 Add msim_check_mail to check for new mail (called periodically), and
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17946
diff changeset
95 /* Time to check for new mail (milliseconds) */
17949
81a1f0c60a8d Increase mail check interval to 1 minute.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17948
diff changeset
96 #define MSIM_MAIL_INTERVAL_CHECK (60 * 1000)
17947
ac7066ffa109 Add msim_check_mail to check for new mail (called periodically), and
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17946
diff changeset
97
ac7066ffa109 Add msim_check_mail to check for new mail (called periodically), and
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17946
diff changeset
98
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
99 /* Constants */
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
100 #define HASH_SIZE 0x14 /**< Size of SHA-1 hash for login */
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
101 #define NONCE_SIZE 0x20 /**< Half of decoded 'nc' field */
17954
016f9b2d6ee0 Increase read buffer size and be more careful about overruns.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17953
diff changeset
102 #define MSIM_READ_BUF_SIZE (15 * 1024) /**< Receive buffer size */
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
103 #define MSIM_FINAL_STRING "\\final\\" /**< Message end marker */
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
104
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
105 /* Messages */
17953
bde17299004b Support unofficial bm code 200, also used by Miranda IM plugin, to report
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17952
diff changeset
106 #define MSIM_BM_INSTANT 1
bde17299004b Support unofficial bm code 200, also used by Miranda IM plugin, to report
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17952
diff changeset
107 #define MSIM_BM_STATUS 100
bde17299004b Support unofficial bm code 200, also used by Miranda IM plugin, to report
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17952
diff changeset
108 #define MSIM_BM_ACTION 121
bde17299004b Support unofficial bm code 200, also used by Miranda IM plugin, to report
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17952
diff changeset
109 #define MSIM_BM_MEDIA 122
bde17299004b Support unofficial bm code 200, also used by Miranda IM plugin, to report
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17952
diff changeset
110 #define MSIM_BM_PROFILE 124
bde17299004b Support unofficial bm code 200, also used by Miranda IM plugin, to report
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17952
diff changeset
111 #define MSIM_BM_UNOFFICIAL_CLIENT 200
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
112
16734
3f53f8f502b2 Replacement magic numbers by symbolic constants.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16732
diff changeset
113 /* Authentication algorithm for login2 */
3f53f8f502b2 Replacement magic numbers by symbolic constants.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16732
diff changeset
114 #define MSIM_AUTH_ALGORITHM 196610
3f53f8f502b2 Replacement magic numbers by symbolic constants.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16732
diff changeset
115
17941
dcbb535e8d55 Lowercase password before sending it. Closes #2066.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17695
diff changeset
116 /* Recognized challenge length */
dcbb535e8d55 Lowercase password before sending it. Closes #2066.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17695
diff changeset
117 #define MSIM_AUTH_CHALLENGE_LENGTH 0x40
dcbb535e8d55 Lowercase password before sending it. Closes #2066.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17695
diff changeset
118
17652
06d60201e371 Use constants for IP address list, defined in myspace.h.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17651
diff changeset
119 /* TODO: obtain IPs of network interfaces from user's machine, instead of
06d60201e371 Use constants for IP address list, defined in myspace.h.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17651
diff changeset
120 * hardcoding these values below (used in msim_compute_login_response).
06d60201e371 Use constants for IP address list, defined in myspace.h.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17651
diff changeset
121 * This is not immediately
06d60201e371 Use constants for IP address list, defined in myspace.h.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17651
diff changeset
122 * important because you can still connect and perform basic
06d60201e371 Use constants for IP address list, defined in myspace.h.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17651
diff changeset
123 * functions of the protocol. There is also a high chance that the addreses
06d60201e371 Use constants for IP address list, defined in myspace.h.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17651
diff changeset
124 * are RFC1918 private, so the servers couldn't do anything with them
06d60201e371 Use constants for IP address list, defined in myspace.h.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17651
diff changeset
125 * anyways except make note of that fact. Probably important for any
06d60201e371 Use constants for IP address list, defined in myspace.h.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17651
diff changeset
126 * kind of direct connection, or file transfer functionality.
06d60201e371 Use constants for IP address list, defined in myspace.h.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17651
diff changeset
127 */
06d60201e371 Use constants for IP address list, defined in myspace.h.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17651
diff changeset
128
06d60201e371 Use constants for IP address list, defined in myspace.h.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17651
diff changeset
129 #define MSIM_LOGIN_IP_LIST "\x00\x00\x00\x00\x05\x7f\x00\x00\x01\x00\x00\x00\x00\x0a\x00\x00\x40\xc0\xa8\x58\x01\xc0\xa8\x3c\x01"
06d60201e371 Use constants for IP address list, defined in myspace.h.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17651
diff changeset
130 #define MSIM_LOGIN_IP_LIST_LEN 25
06d60201e371 Use constants for IP address list, defined in myspace.h.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17651
diff changeset
131
17289
73720427b132 Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17286
diff changeset
132 /* Indexes into status string (0|1|2|3|..., but 0 always empty) */
73720427b132 Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17286
diff changeset
133 #define MSIM_STATUS_ORDINAL_EMPTY 0
73720427b132 Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17286
diff changeset
134 #define MSIM_STATUS_ORDINAL_UNKNOWNs 1
73720427b132 Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17286
diff changeset
135 #define MSIM_STATUS_ORDINAL_ONLINE 2
73720427b132 Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17286
diff changeset
136 #define MSIM_STATUS_ORDINAL_UNKNOWNss 3
73720427b132 Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17286
diff changeset
137 #define MSIM_STATUS_ORDINAL_HEADLINE 4
73720427b132 Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17286
diff changeset
138 #define MSIM_STATUS_ORDINAL_UNKNOWNls 5
73720427b132 Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17286
diff changeset
139 #define MSIM_STATUS_ORDINAL_UNKNOWN 6
73720427b132 Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17286
diff changeset
140 #define MSIM_STATUS_ORDINAL_UNKNOWN1 7
73720427b132 Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17286
diff changeset
141 #define MSIM_STATUS_ORDINAL_UNKNOWNp 8
73720427b132 Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17286
diff changeset
142 #define MSIM_STATUS_ORDINAL_UNKNOWN2 9
73720427b132 Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17286
diff changeset
143
17674
e24d44e3b6d2 Recognize online/away status of buddies on buddy list.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17670
diff changeset
144 /* Status codes - states a buddy (or you!) can be in. */
17680
d87916bd1d73 Fix email address.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17679
diff changeset
145 #define MSIM_STATUS_CODE_OFFLINE_OR_HIDDEN 0
17674
e24d44e3b6d2 Recognize online/away status of buddies on buddy list.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17670
diff changeset
146 #define MSIM_STATUS_CODE_ONLINE 1
17686
87b77f1ea086 Add support for idle.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17684
diff changeset
147 #define MSIM_STATUS_CODE_IDLE 2
17674
e24d44e3b6d2 Recognize online/away status of buddies on buddy list.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17670
diff changeset
148 #define MSIM_STATUS_CODE_AWAY 5
17691
b9fd55903979 General clean up and adding more error-checking.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17690
diff changeset
149
b9fd55903979 General clean up and adding more error-checking.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17690
diff changeset
150 /* Text formatting bits for <f s=#> */
b9fd55903979 General clean up and adding more error-checking.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17690
diff changeset
151 #define MSIM_TEXT_BOLD 1
17695
13bba54b429d Support sending some formatted text in instant messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17692
diff changeset
152 #define MSIM_TEXT_ITALIC 2
17691
b9fd55903979 General clean up and adding more error-checking.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17690
diff changeset
153 #define MSIM_TEXT_UNDERLINE 4
17674
e24d44e3b6d2 Recognize online/away status of buddies on buddy list.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17670
diff changeset
154
17952
4001661344e4 Make DPI and base font point size configurable in account options. This
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17949
diff changeset
155 /* Default baseline size of purple's fonts, in points. What is size 3 in points.
4001661344e4 Make DPI and base font point size configurable in account options. This
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17949
diff changeset
156 * _font_scale specifies scaling factor relative to this point size. Note this
4001661344e4 Make DPI and base font point size configurable in account options. This
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17949
diff changeset
157 * is only the default; it is configurable in account options. */
4001661344e4 Make DPI and base font point size configurable in account options. This
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17949
diff changeset
158 #define MSIM_BASE_FONT_POINT_SIZE 8
4001661344e4 Make DPI and base font point size configurable in account options. This
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17949
diff changeset
159
4001661344e4 Make DPI and base font point size configurable in account options. This
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17949
diff changeset
160 /* Default display's DPI. 96 is common but it can differ. Also configurable
4001661344e4 Make DPI and base font point size configurable in account options. This
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17949
diff changeset
161 * in account options. */
4001661344e4 Make DPI and base font point size configurable in account options. This
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17949
diff changeset
162 #define MSIM_DEFAULT_DPI 96
4001661344e4 Make DPI and base font point size configurable in account options. This
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17949
diff changeset
163
4001661344e4 Make DPI and base font point size configurable in account options. This
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17949
diff changeset
164
17269
57bde8784308 (Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17266
diff changeset
165 /* Random number in every MsimSession, to ensure it is valid. */
57bde8784308 (Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17266
diff changeset
166 #define MSIM_SESSION_STRUCT_MAGIC 0xe4a6752b
57bde8784308 (Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17266
diff changeset
167
17948
c23122e0af91 Notify of new inbox messages (friend requests, inbox messages, comments),
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17947
diff changeset
168 /* Inbox status bitfield values for MsimSession.inbox_status */
c23122e0af91 Notify of new inbox messages (friend requests, inbox messages, comments),
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17947
diff changeset
169 #define MSIM_INBOX_MAIL (1 << 0)
c23122e0af91 Notify of new inbox messages (friend requests, inbox messages, comments),
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17947
diff changeset
170 #define MSIM_INBOX_BLOG_COMMENT (1 << 1)
c23122e0af91 Notify of new inbox messages (friend requests, inbox messages, comments),
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17947
diff changeset
171 #define MSIM_INBOX_PROFILE_COMMENT (1 << 2)
c23122e0af91 Notify of new inbox messages (friend requests, inbox messages, comments),
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17947
diff changeset
172 #define MSIM_INBOX_FRIEND_REQUEST (1 << 3)
c23122e0af91 Notify of new inbox messages (friend requests, inbox messages, comments),
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17947
diff changeset
173 #define MSIM_INBOX_PICTURE_COMMENT (1 << 4)
c23122e0af91 Notify of new inbox messages (friend requests, inbox messages, comments),
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17947
diff changeset
174
17269
57bde8784308 (Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17266
diff changeset
175 /* Everything needed to keep track of a session. */
57bde8784308 (Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17266
diff changeset
176 typedef struct _MsimSession
57bde8784308 (Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17266
diff changeset
177 {
57bde8784308 (Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17266
diff changeset
178 guint magic; /**< MSIM_SESSION_STRUCT_MAGIC */
57bde8784308 (Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17266
diff changeset
179 PurpleAccount *account;
57bde8784308 (Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17266
diff changeset
180 PurpleConnection *gc;
17297
c2208b64bffb Change MsimSession.sesskey to an integer (used to be a string), now that
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17296
diff changeset
181 guint sesskey; /**< Session key from server */
17316
2aff11bb5e72 Several small changes to work towards a working msim_remove_buddy():
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17315
diff changeset
182 guint userid; /**< This user's numeric user ID */
17670
7e4e3f6582d2 Add MSIM_FAKE_SELF_ONLINE preprocessor definition (which I define) to fake
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17665
diff changeset
183 gchar *username; /**< This user's unique username */
17269
57bde8784308 (Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17266
diff changeset
184 gint fd; /**< File descriptor to/from server */
57bde8784308 (Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17266
diff changeset
185
17313
7a0061f4845d Add msim_uid2username_from_blist() to lookup a username by userid, by
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17309
diff changeset
186 /* TODO: Remove. */
17269
57bde8784308 (Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17266
diff changeset
187 GHashTable *user_lookup_cb; /**< Username -> userid lookup callback */
57bde8784308 (Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17266
diff changeset
188 GHashTable *user_lookup_cb_data; /**< Username -> userid lookup callback data */
57bde8784308 (Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17266
diff changeset
189
17966
f1827c3dc65a Add msim_process_server_info() to save the server information dictionary
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17965
diff changeset
190 GHashTable *server_info; /**< Parameters from server */
f1827c3dc65a Add msim_process_server_info() to save the server information dictionary
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17965
diff changeset
191
17269
57bde8784308 (Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17266
diff changeset
192 gchar *rxbuf; /**< Receive buffer */
57bde8784308 (Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17266
diff changeset
193 guint rxoff; /**< Receive buffer offset */
57bde8784308 (Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17266
diff changeset
194 guint next_rid; /**< Next request/response ID */
17687
d0c8b7748065 Add msim_check_alive(), called every MSIM_KEEPALIVE_INTERVAL_CHECK milliseconds,
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17686
diff changeset
195 time_t last_comm; /**< Time received last communication */
17948
c23122e0af91 Notify of new inbox messages (friend requests, inbox messages, comments),
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17947
diff changeset
196 guint inbox_status; /**< Bit field of inbox notifications */
17269
57bde8784308 (Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17266
diff changeset
197 } MsimSession;
57bde8784308 (Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17266
diff changeset
198
57bde8784308 (Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17266
diff changeset
199 /* Check if an MsimSession is valid */
57bde8784308 (Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17266
diff changeset
200 #define MSIM_SESSION_VALID(s) (session != NULL && \
57bde8784308 (Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17266
diff changeset
201 session->magic == MSIM_SESSION_STRUCT_MAGIC)
57bde8784308 (Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17266
diff changeset
202
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
203 /* Callback function pointer type for when a user's information is received,
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
204 * initiated from a user lookup. */
17280
d3e17c9d16e9 Use MsimMessage for receiving messages everywhere, instead of GHashTable.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17275
diff changeset
205 typedef void (*MSIM_USER_LOOKUP_CB)(MsimSession *session, MsimMessage *userinfo,
17300
176b1ba4bafe Remove 'flags' from send_im_cb_struct - it was never needed.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17297
diff changeset
206 gpointer data);
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
207
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
208 /* Functions */
16736
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
209 gboolean msim_load(PurplePlugin *plugin);
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
210 GList *msim_status_types(PurpleAccount *acct);
17963
8305709dd0b9 Allow sending zaps through buddy list menu.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17962
diff changeset
211
8305709dd0b9 Allow sending zaps through buddy list menu.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17962
diff changeset
212 void msim_send_zap(PurpleBlistNode *node, gpointer zap_num_ptr);
8305709dd0b9 Allow sending zaps through buddy list menu.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17962
diff changeset
213 GList *msim_blist_node_menu(PurpleBlistNode *node);
8305709dd0b9 Allow sending zaps through buddy list menu.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17962
diff changeset
214
16736
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
215 const gchar *msim_list_icon(PurpleAccount *acct, PurpleBuddy *buddy);
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
216
16738
0fa4a3e9b318 Stylistic improvements - use type *name instead of type* name for pointers
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16737
diff changeset
217 gchar *str_replace(const gchar *str, const gchar *old, const gchar *new);
16735
52357f6392a4 Add partial implementation of MsimMessage (not used anywhere yet).
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16734
diff changeset
218
16736
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
219 void print_hash_item(gpointer key, gpointer value, gpointer user_data);
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
220 gboolean msim_send_raw(MsimSession *session, const gchar *msg);
17660
cbda7f26d27d Add a send_raw function, msim_send_really_raw, into the prpl_info struct,
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17656
diff changeset
221 int msim_send_really_raw(PurpleConnection *gc, const char *buf,int total_bytes);
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
222
16736
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
223 void msim_login(PurpleAccount *acct);
17291
d8903e1320a9 Previously, the return value of the processing function and msim_process() told
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17290
diff changeset
224 gboolean msim_login_challenge(MsimSession *session, MsimMessage *msg);
17326
f057837085b0 Change to use const gchar * where appropriate.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17325
diff changeset
225 const gchar *msim_compute_login_response(const gchar nonce[2 * NONCE_SIZE],
f057837085b0 Change to use const gchar * where appropriate.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17325
diff changeset
226 const gchar *email, const gchar *password, guint *response_len);
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
227
17290
aa8e70fa1edc Add, but do not use, incomplete functions for using typing notifications.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17289
diff changeset
228
17326
f057837085b0 Change to use const gchar * where appropriate.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17325
diff changeset
229 int msim_send_im(PurpleConnection *gc, const gchar *who, const gchar *message,
17300
176b1ba4bafe Remove 'flags' from send_im_cb_struct - it was never needed.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17297
diff changeset
230 PurpleMessageFlags flags);
17326
f057837085b0 Change to use const gchar * where appropriate.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17325
diff changeset
231 gboolean msim_send_bm(MsimSession *session, const gchar *who, const gchar *text, int type);
17952
4001661344e4 Make DPI and base font point size configurable in account options. This
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17949
diff changeset
232 guint msim_point_to_purple_size(MsimSession *session, guint point);
4001661344e4 Make DPI and base font point size configurable in account options. This
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17949
diff changeset
233 guint msim_purple_size_to_point(MsimSession *session, guint size);
4001661344e4 Make DPI and base font point size configurable in account options. This
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17949
diff changeset
234 guint msim_height_to_point(MsimSession *session, guint height);
4001661344e4 Make DPI and base font point size configurable in account options. This
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17949
diff changeset
235 guint msim_point_to_height(MsimSession *session, guint point);
17303
ceba4fc06c41 Change msim_send_im_by_userid_cb() to msim_send_im_cb(), and remove
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17300
diff changeset
236 void msim_send_im_cb(MsimSession *session, MsimMessage *userinfo, gpointer data);
17300
176b1ba4bafe Remove 'flags' from send_im_cb_struct - it was never needed.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17297
diff changeset
237
17651
333fe6ac1046 Add msim_unrecognized() to handle unhandled messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17649
diff changeset
238 void msim_unrecognized(MsimSession *session, MsimMessage *msg, gchar *note);
333fe6ac1046 Add msim_unrecognized() to handle unhandled messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17649
diff changeset
239
17695
13bba54b429d Support sending some formatted text in instant messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17692
diff changeset
240
17952
4001661344e4 Make DPI and base font point size configurable in account options. This
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17949
diff changeset
241 typedef void (*MSIM_XMLNODE_CONVERT)(MsimSession *, xmlnode *, gchar **, gchar **);
4001661344e4 Make DPI and base font point size configurable in account options. This
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17949
diff changeset
242 void msim_markup_tag_to_html(MsimSession *, xmlnode *root, gchar **begin, gchar **end);
4001661344e4 Make DPI and base font point size configurable in account options. This
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17949
diff changeset
243 void html_tag_to_msim_markup(MsimSession *, xmlnode *root, gchar **begin, gchar **end);
4001661344e4 Make DPI and base font point size configurable in account options. This
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17949
diff changeset
244 gchar *msim_convert_xml(MsimSession *, const gchar *raw, MSIM_XMLNODE_CONVERT f);
17961
e5525819d652 Finish emoticon support. You can now send smileys to yourself, they can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17955
diff changeset
245 gchar *msim_convert_smileys_to_markup(gchar *before);
17695
13bba54b429d Support sending some formatted text in instant messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17692
diff changeset
246
13bba54b429d Support sending some formatted text in instant messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17692
diff changeset
247 /* High-level msim markup <=> html conversion functions. */
17952
4001661344e4 Make DPI and base font point size configurable in account options. This
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17949
diff changeset
248 gchar *msim_markup_to_html(MsimSession *, const gchar *raw);
4001661344e4 Make DPI and base font point size configurable in account options. This
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17949
diff changeset
249 gchar *html_to_msim_markup(MsimSession *, const gchar *raw);
17695
13bba54b429d Support sending some formatted text in instant messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17692
diff changeset
250
17955
9e8943111022 Show official client build in buddy profiles.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17954
diff changeset
251 gboolean msim_incoming_bm_record_cv(MsimSession *session, MsimMessage *msg);
17953
bde17299004b Support unofficial bm code 200, also used by Miranda IM plugin, to report
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17952
diff changeset
252 gboolean msim_incoming_bm(MsimSession *session, MsimMessage *msg);
bde17299004b Support unofficial bm code 200, also used by Miranda IM plugin, to report
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17952
diff changeset
253 gboolean msim_incoming_status(MsimSession *session, MsimMessage *msg);
bde17299004b Support unofficial bm code 200, also used by Miranda IM plugin, to report
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17952
diff changeset
254 gboolean msim_incoming_im(MsimSession *session, MsimMessage *msg);
17962
8e351e08aba0 Support incoming zaps.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17961
diff changeset
255 gboolean msim_incoming_zap(MsimSession *session, MsimMessage *msg);
17953
bde17299004b Support unofficial bm code 200, also used by Miranda IM plugin, to report
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17952
diff changeset
256 gboolean msim_incoming_action(MsimSession *session, MsimMessage *msg);
bde17299004b Support unofficial bm code 200, also used by Miranda IM plugin, to report
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17952
diff changeset
257 gboolean msim_incoming_media(MsimSession *session, MsimMessage *msg);
bde17299004b Support unofficial bm code 200, also used by Miranda IM plugin, to report
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17952
diff changeset
258 gboolean msim_incoming_unofficial_client(MsimSession *session, MsimMessage *msg);
bde17299004b Support unofficial bm code 200, also used by Miranda IM plugin, to report
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17952
diff changeset
259
bde17299004b Support unofficial bm code 200, also used by Miranda IM plugin, to report
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17952
diff changeset
260 gboolean msim_send_unofficial_client(MsimSession *session, gchar *username);
17290
aa8e70fa1edc Add, but do not use, incomplete functions for using typing notifications.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17289
diff changeset
261
17326
f057837085b0 Change to use const gchar * where appropriate.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17325
diff changeset
262 unsigned int msim_send_typing(PurpleConnection *gc, const gchar *name, PurpleTypingState state);
17656
61f0b36b9891 Retrieve information for profile ("Get Info") from server, instead of from
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17653
diff changeset
263 void msim_get_info_cb(MsimSession *session, MsimMessage *userinfo, gpointer data);
17326
f057837085b0 Change to use const gchar * where appropriate.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17325
diff changeset
264 void msim_get_info(PurpleConnection *gc, const gchar *name);
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
265
17679
608e4b47dfae Allow setting status to away or online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17674
diff changeset
266 void msim_set_status(PurpleAccount *account, PurpleStatus *status);
17686
87b77f1ea086 Add support for idle.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17684
diff changeset
267 void msim_set_idle(PurpleConnection *gc, int time);
17944
c109b7f1c739 Allow setting status string messages. Known bug: custom status messages always
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17941
diff changeset
268 void msim_set_status_code(MsimSession *session, guint code, gchar *statstring);
17679
608e4b47dfae Allow setting status to away or online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17674
diff changeset
269
17322
6fa345a01dd8 Show buddy information in tooltip text, and the display name for status text.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17321
diff changeset
270 void msim_store_buddy_info_each(gpointer key, gpointer value, gpointer user_data);
6fa345a01dd8 Show buddy information in tooltip text, and the display name for status text.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17321
diff changeset
271 gboolean msim_store_buddy_info(MsimSession *session, MsimMessage *msg);
17966
f1827c3dc65a Add msim_process_server_info() to save the server information dictionary
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17965
diff changeset
272 gboolean msim_process_server_info(MsimSession *session, MsimMessage *msg);
17967
c9acdf96e74e Update login process to more closely match official client.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17966
diff changeset
273 gboolean msim_web_challenge(MsimSession *session, MsimMessage *msg);
17291
d8903e1320a9 Previously, the return value of the processing function and msim_process() told
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17290
diff changeset
274 gboolean msim_process_reply(MsimSession *session, MsimMessage *msg);
17306
3a02e7db91c7 Add message preprocessing in msim_preprocess_incoming(), to resolve
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17303
diff changeset
275
3a02e7db91c7 Add message preprocessing in msim_preprocess_incoming(), to resolve
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17303
diff changeset
276 gboolean msim_preprocess_incoming(MsimSession *session, MsimMessage *msg);
17309
25a55b52855a Add, but do not use, two new functions to postprocess outgoing messages
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17307
diff changeset
277
17687
d0c8b7748065 Add msim_check_alive(), called every MSIM_KEEPALIVE_INTERVAL_CHECK milliseconds,
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17686
diff changeset
278 gboolean msim_check_alive(gpointer data);
17681
5e8c02259c81 Add option to sign on as hidden, or as not (previously, always signed on
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17680
diff changeset
279 gboolean msim_we_are_logged_on(MsimSession *session, MsimMessage *msg);
5e8c02259c81 Add option to sign on as hidden, or as not (previously, always signed on
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17680
diff changeset
280
17306
3a02e7db91c7 Add message preprocessing in msim_preprocess_incoming(), to resolve
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17303
diff changeset
281 gboolean msim_process(MsimSession *session, MsimMessage *msg);
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
282
17326
f057837085b0 Change to use const gchar * where appropriate.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17325
diff changeset
283 MsimMessage *msim_do_postprocessing(MsimMessage *msg, const gchar *uid_field_name, const gchar *uid_before, guint uid);
17309
25a55b52855a Add, but do not use, two new functions to postprocess outgoing messages
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17307
diff changeset
284 void msim_postprocess_outgoing_cb(MsimSession *session, MsimMessage *userinfo, gpointer data);
17326
f057837085b0 Change to use const gchar * where appropriate.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17325
diff changeset
285 gboolean msim_postprocess_outgoing(MsimSession *session, MsimMessage *msg, const gchar *username,
f057837085b0 Change to use const gchar * where appropriate.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17325
diff changeset
286 const gchar *uid_field_name, const gchar *uid_before);
17309
25a55b52855a Add, but do not use, two new functions to postprocess outgoing messages
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17307
diff changeset
287
25a55b52855a Add, but do not use, two new functions to postprocess outgoing messages
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17307
diff changeset
288
17291
d8903e1320a9 Previously, the return value of the processing function and msim_process() told
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17290
diff changeset
289 gboolean msim_error(MsimSession *session, MsimMessage *msg);
17293
bfda36bd957a Add incomplete msim_add_buddy() implementation.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17291
diff changeset
290
bfda36bd957a Add incomplete msim_add_buddy() implementation.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17291
diff changeset
291 void msim_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group);
17296
1905859d7a3b Add (incomplete) msim_remove_buddy().
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17293
diff changeset
292 void msim_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group);
17293
bfda36bd957a Add incomplete msim_add_buddy() implementation.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17291
diff changeset
293
17324
df93e8773981 Add msim_offline_message() for offline message status. Always return TRUE,
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17322
diff changeset
294 gboolean msim_offline_message(const PurpleBuddy *buddy);
df93e8773981 Add msim_offline_message() for offline message status. Always return TRUE,
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17322
diff changeset
295
17948
c23122e0af91 Notify of new inbox messages (friend requests, inbox messages, comments),
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17947
diff changeset
296 void msim_check_inbox_cb(MsimSession *session, MsimMessage *userinfo, gpointer data);
c23122e0af91 Notify of new inbox messages (friend requests, inbox messages, comments),
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17947
diff changeset
297 gboolean msim_check_inbox(gpointer data);
17947
ac7066ffa109 Add msim_check_mail to check for new mail (called periodically), and
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17946
diff changeset
298
16736
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
299 void msim_input_cb(gpointer gc_uncasted, gint source,
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
300 PurpleInputCondition cond);
17316
2aff11bb5e72 Several small changes to work towards a working msim_remove_buddy():
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17315
diff changeset
301
2aff11bb5e72 Several small changes to work towards a working msim_remove_buddy():
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17315
diff changeset
302 guint msim_new_reply_callback(MsimSession *session, MSIM_USER_LOOKUP_CB cb, gpointer data);
2aff11bb5e72 Several small changes to work towards a working msim_remove_buddy():
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17315
diff changeset
303
16736
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
304 void msim_connect_cb(gpointer data, gint source,
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
305 const gchar *error_message);
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
306
16736
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
307 MsimSession *msim_session_new(PurpleAccount *acct);
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
308 void msim_session_destroy(MsimSession *session);
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
309
16736
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
310 void msim_close(PurpleConnection *gc);
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
311
16736
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
312 gboolean msim_is_userid(const gchar *user);
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
313 gboolean msim_is_email(const gchar *user);
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
314
16736
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
315 void msim_lookup_user(MsimSession *session, const gchar *user,
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
316 MSIM_USER_LOOKUP_CB cb, gpointer data);
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
317
16736
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
318 char *msim_status_text(PurpleBuddy *buddy);
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
319 void msim_tooltip_text(PurpleBuddy *buddy,
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
320 PurpleNotifyUserInfo *user_info, gboolean full);
17965
e3687194f2b2 Use MsimMessage's new list type for status messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17963
diff changeset
321 GList *msim_actions(PurplePlugin *plugin, gpointer context);
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
322
17662
7b890c79aabf Add msim_markup_to_html() to convert MySpaceIM-style markup to Purple-compatible
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17660
diff changeset
323 #ifdef MSIM_SELF_TEST
7b890c79aabf Add msim_markup_to_html() to convert MySpaceIM-style markup to Purple-compatible
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17660
diff changeset
324 void msim_test_all(void) __attribute__((__noreturn__));
7b890c79aabf Add msim_markup_to_html() to convert MySpaceIM-style markup to Purple-compatible
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17660
diff changeset
325 int msim_test_xml(void);
17648
23f57d36cb65 Add msim_test_all() and related procedures, to perform basic functionality
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17326
diff changeset
326 int msim_test_msg(void);
23f57d36cb65 Add msim_test_all() and related procedures, to perform basic functionality
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17326
diff changeset
327 int msim_test_escaping(void);
17662
7b890c79aabf Add msim_markup_to_html() to convert MySpaceIM-style markup to Purple-compatible
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17660
diff changeset
328 #endif
17648
23f57d36cb65 Add msim_test_all() and related procedures, to perform basic functionality
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17326
diff changeset
329
16736
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
330 void init_plugin(PurplePlugin *plugin);
496855295bd7 Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16735
diff changeset
331
16735
52357f6392a4 Add partial implementation of MsimMessage (not used anywhere yet).
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16734
diff changeset
332 #endif /* !_MYSPACE_MYSPACE_H */