annotate libpurple/protocols/myspace/myspace.h @ 32819:2c6510167895 default tip

propagate from branch 'im.pidgin.pidgin.2.x.y' (head 3315c5dfbd0ad16511bdcf865e5b07c02d07df24) to branch 'im.pidgin.pidgin' (head cbd1eda6bcbf0565ae7766396bb8f6f419cb6a9a)
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 02 Jun 2012 02:30:49 +0000
parents f1437342cc0e
children
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
19681
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19598
diff changeset
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
16405
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
28647
f1437342cc0e Include 'internal.h' before all other headers to make some non-gcc compilers happy.
Paul Aurich <paul@darkrain42.org>
parents: 27904
diff changeset
23 #include "internal.h"
f1437342cc0e Include 'internal.h' before all other headers to make some non-gcc compilers happy.
Paul Aurich <paul@darkrain42.org>
parents: 27904
diff changeset
24
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
25 /* 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
26 #include <string.h>
18895
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
27 #include <errno.h>/* for EAGAIN */
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
28 #include <stdarg.h>
17971
13a4f57f53a9 Implement round() if it is not available, using floor().
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17970
diff changeset
29 #include <math.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
30
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 <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
32
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 #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
34 #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
35 #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
36 /* 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
37 #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
38 #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
39 #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
40
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 "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
42 #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
43 #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
44 #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
45 #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
46 #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
47 #include "debug.h" /* for purple_debug_info */
22303
1097406c8f6c In msimprpl, change to patch from Jaywalker regarding setting
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 22302
diff changeset
48 #include "request.h" /* For dialogs used in setting the username */
17662
7b890c79aabf Add msim_markup_to_html() to convert MySpaceIM-style markup to Purple-compatible
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17660
diff changeset
49 #include "xmlnode.h"
19436
a62c9b9c4596 Add msim_uri_handler() to handle myim: URLs, sendIM and addContact commands.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19435
diff changeset
50 #include "core.h"
24406
1406a2fa649d A patch from Jaywalker to better handle conversations by user ID vs.
Richard Laager <rlaager@wiktel.com>
parents: 22305
diff changeset
51 #include "conversation.h" /* For late normalization */
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
52
17266
793301c04e3a (Incomplete - plugin does not load) Begin migrating protocol message receiving to MsimMessage.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16738
diff changeset
53 /* MySpaceIM includes */
19435
bddc6a6fddf0 In msimprpl, move user-related code to a new user module, and move other
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19434
diff changeset
54 #include "persist.h"
17266
793301c04e3a (Incomplete - plugin does not load) Begin migrating protocol message receiving to MsimMessage.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16738
diff changeset
55 #include "message.h"
19432
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19427
diff changeset
56 #include "session.h"
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19427
diff changeset
57 #include "zap.h"
19434
1e00b684c46f In msimprpl, move formatting functions to a markup module. It only exposes
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19432
diff changeset
58 #include "markup.h"
19435
bddc6a6fddf0 In msimprpl, move user-related code to a new user module, and move other
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19434
diff changeset
59 #include "user.h"
17266
793301c04e3a (Incomplete - plugin does not load) Begin migrating protocol message receiving to MsimMessage.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16738
diff changeset
60
16725
58cd11fcd84f Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16723
diff changeset
61 /* Conditional compilation options */
17974
3d400b022acc Disable sending third-party client version to oncoming buddies.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17971
diff changeset
62 /* Send third-party client version? (Recognized by us and Miranda's plugin) */
18895
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
63 /*#define MSIM_SEND_CLIENT_VERSION */
16725
58cd11fcd84f Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16723
diff changeset
64
58cd11fcd84f Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16723
diff changeset
65 /* Debugging options */
16407
bb649c52fc19 Replace printf() in MySpaceIM prpl with purple_debug_info().
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16405
diff changeset
66 /* Low-level and rarely needed */
18895
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
67 /*#define MSIM_DEBUG_PARSE */
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
68 /*#define MSIM_DEBUG_LOGIN_CHALLENGE*/
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
69 /*#define MSIM_DEBUG_RXBUF */
16725
58cd11fcd84f Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16723
diff changeset
70
24767
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
71 /* Encode unknown HTML tags from IM clients in messages as [tag], instead of
20273
187fa336c1b0 Plucked mysapce tag parsing fixes
Evan Schoenberg <evan.s@dreskin.net>
parents: 19714
diff changeset
72 * ignoring. Useful for debugging */
187fa336c1b0 Plucked mysapce tag parsing fixes
Evan Schoenberg <evan.s@dreskin.net>
parents: 19714
diff changeset
73 /*#define MSIM_MARKUP_SHOW_UNKNOWN_TAGS */
187fa336c1b0 Plucked mysapce tag parsing fixes
Evan Schoenberg <evan.s@dreskin.net>
parents: 19714
diff changeset
74
17651
333fe6ac1046 Add msim_unrecognized() to handle unhandled messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17649
diff changeset
75 /* Define to cause init_plugin() to run some tests and print
24767
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
76 * the results to the Purple debug log, then exit. Useful to
17651
333fe6ac1046 Add msim_unrecognized() to handle unhandled messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17649
diff changeset
77 * 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
78 * you want to actually use the plugin! */
18906
8b3ca7be9b72 Re-enable non-test mode. This revision now correctly handles links with paths.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18905
diff changeset
79 /*#define MSIM_SELF_TEST */
17651
333fe6ac1046 Add msim_unrecognized() to handle unhandled messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17649
diff changeset
80
16725
58cd11fcd84f Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16723
diff changeset
81 /* Constants */
16407
bb649c52fc19 Replace printf() in MySpaceIM prpl with purple_debug_info().
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16405
diff changeset
82
17684
e440846f9a21 Increase password length limit to 10 and update changes file.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17683
diff changeset
83 /* 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
84 * 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
85 * 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
86 * (though curiously, not on the 'current password' field). */
19247
44b9e41bde2a No longer check the length of passwords - instead, pass the password to the
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19246
diff changeset
87
22268
1f3481447197 In msimprpl, if login fails, and the user's password is greater than
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 22156
diff changeset
88 /* After login fails, if password is greater than this many characters,
1f3481447197 In msimprpl, if login fails, and the user's password is greater than
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 22156
diff changeset
89 * warn user that it may be too long. */
1f3481447197 In msimprpl, if login fails, and the user's password is greater than
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 22156
diff changeset
90 #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
91
22305
bf4902fce6e4 In msimprpl, add msim_is_valid_username() to check whether a username
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 22303
diff changeset
92 /* Maximum length of usernames, when setting. */
bf4902fce6e4 In msimprpl, add msim_is_valid_username() to check whether a username
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 22303
diff changeset
93 #define MSIM_MAX_USERNAME_LENGTH 25
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
94
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
95 /* 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
96 #define MSIM_CLIENT_VERSION 697
c9acdf96e74e Update login process to more closely match official client.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17966
diff changeset
97
19598
339c7c8c0e08 If MSIM_CHECK_NEWER_VERSION is defined (off by default), run (incomplete)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19596
diff changeset
98 /* Check for a newer official MySpaceIM client on startup?
339c7c8c0e08 If MSIM_CHECK_NEWER_VERSION is defined (off by default), run (incomplete)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19596
diff changeset
99 * (Mostly useful for developers) */
339c7c8c0e08 If MSIM_CHECK_NEWER_VERSION is defined (off by default), run (incomplete)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19596
diff changeset
100 /*#define MSIM_CHECK_NEWER_VERSION*/
339c7c8c0e08 If MSIM_CHECK_NEWER_VERSION is defined (off by default), run (incomplete)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19596
diff changeset
101
17967
c9acdf96e74e Update login process to more closely match official client.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17966
diff changeset
102 /* 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
103 #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
104 #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
105
bde17299004b Support unofficial bm code 200, also used by Miranda IM plugin, to report
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17952
diff changeset
106 /* msimprpl version string of this plugin */
19596
582a5608cfc1 Update msimprpl to 0.18, targetting Pidgin/libpurple 2.2.0. msimprpl 0.17 was
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19595
diff changeset
107 #define MSIM_PRPL_VERSION_STRING "0.18"
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
108
17687
d0c8b7748065 Add msim_check_alive(), called every MSIM_KEEPALIVE_INTERVAL_CHECK milliseconds,
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17686
diff changeset
109 /* Default server */
18895
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
110 #define MSIM_SERVER "im.myspace.akadns.net"
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
111 #define MSIM_PORT 1863 /* TODO: alternate ports and automatic */
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
112
17687
d0c8b7748065 Add msim_check_alive(), called every MSIM_KEEPALIVE_INTERVAL_CHECK milliseconds,
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17686
diff changeset
113 /* Time between keepalives (seconds) - if no data within this time, is dead. */
18895
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
114 #define MSIM_KEEPALIVE_INTERVAL (3 * 60)
22303
1097406c8f6c In msimprpl, change to patch from Jaywalker regarding setting
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 22302
diff changeset
115 /*#define MSIM_USE_KEEPALIVE*/
17687
d0c8b7748065 Add msim_check_alive(), called every MSIM_KEEPALIVE_INTERVAL_CHECK milliseconds,
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17686
diff changeset
116
25576
7f552614ec8a applied changes from a336cc1fd3a1ce815f97303b8d5ae8988f8cbd5b
Ethan Blanton <elb@pidgin.im>
parents: 24778
diff changeset
117 /* Time to check if alive (seconds) */
7f552614ec8a applied changes from a336cc1fd3a1ce815f97303b8d5ae8988f8cbd5b
Ethan Blanton <elb@pidgin.im>
parents: 24778
diff changeset
118 #define MSIM_KEEPALIVE_INTERVAL_CHECK 30
17687
d0c8b7748065 Add msim_check_alive(), called every MSIM_KEEPALIVE_INTERVAL_CHECK milliseconds,
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17686
diff changeset
119
17947
ac7066ffa109 Add msim_check_mail to check for new mail (called periodically), and
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17946
diff changeset
120 /* Time to check for new mail (milliseconds) */
24767
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
121 #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
122
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
123 /* Constants */
18895
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
124 #define HASH_SIZE 0x14 /**< Size of SHA-1 hash for login */
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
125 #define NONCE_SIZE 0x20 /**< Half of decoded 'nc' field */
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
126 #define MSIM_READ_BUF_SIZE (15 * 1024) /**< Receive buffer size */
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
127 #define MSIM_FINAL_STRING "\\final\\" /**< Message end marker */
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
128
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
129 /* Messages */
27154
5fbcfcbd6551 Rename MSIM_BM_INSTANT_ACTION_OR_IM to MSIM_BM_ACTION_OR_IM_INSTANT
Mark Doliner <mark@kingant.net>
parents: 27027
diff changeset
130 #define MSIM_BM_ACTION_OR_IM_DELAYABLE 1
27027
fdc0035bea5a Change the way we parse messages on MySpace a little bit. This
Mark Doliner <mark@kingant.net>
parents: 25576
diff changeset
131 #define MSIM_BM_STATUS 100
27154
5fbcfcbd6551 Rename MSIM_BM_INSTANT_ACTION_OR_IM to MSIM_BM_ACTION_OR_IM_INSTANT
Mark Doliner <mark@kingant.net>
parents: 27027
diff changeset
132 #define MSIM_BM_ACTION_OR_IM_INSTANT 121
27027
fdc0035bea5a Change the way we parse messages on MySpace a little bit. This
Mark Doliner <mark@kingant.net>
parents: 25576
diff changeset
133 #define MSIM_BM_MEDIA 122
fdc0035bea5a Change the way we parse messages on MySpace a little bit. This
Mark Doliner <mark@kingant.net>
parents: 25576
diff changeset
134 #define MSIM_BM_PROFILE 124
27904
e4b0bf56667f Explicitly add a stub for the status mood myspace messages. Closes #9887.
Paul Aurich <paul@darkrain42.org>
parents: 27155
diff changeset
135 #define MSIM_BM_STATUS_MOOD 126
27027
fdc0035bea5a Change the way we parse messages on MySpace a little bit. This
Mark Doliner <mark@kingant.net>
parents: 25576
diff changeset
136 #define MSIM_BM_UNOFFICIAL_CLIENT 200
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
137
16734
3f53f8f502b2 Replacement magic numbers by symbolic constants.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16732
diff changeset
138 /* Authentication algorithm for login2 */
18895
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
139 #define MSIM_AUTH_ALGORITHM 196610
16734
3f53f8f502b2 Replacement magic numbers by symbolic constants.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16732
diff changeset
140
17941
dcbb535e8d55 Lowercase password before sending it. Closes #2066.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17695
diff changeset
141 /* Recognized challenge length */
18895
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
142 #define MSIM_AUTH_CHALLENGE_LENGTH 0x40
17941
dcbb535e8d55 Lowercase password before sending it. Closes #2066.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17695
diff changeset
143
27155
8cb0f676c70d Fix a few problems with our myspace login response:
Mark Doliner <mark@kingant.net>
parents: 27154
diff changeset
144 #ifdef SEND_OUR_IP_ADDRESSES
17652
06d60201e371 Use constants for IP address list, defined in myspace.h.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17651
diff changeset
145 /* TODO: obtain IPs of network interfaces from user's machine, instead of
24767
295464ae2d2a No functionality change--just cleanup.
Mark Doliner <mark@kingant.net>
parents: 24451
diff changeset
146 * hardcoding these values below (used in msim_compute_login_response).
17652
06d60201e371 Use constants for IP address list, defined in myspace.h.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17651
diff changeset
147 * This is not immediately
06d60201e371 Use constants for IP address list, defined in myspace.h.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17651
diff changeset
148 * 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
149 * 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
150 * 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
151 * 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
152 * 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
153 */
06d60201e371 Use constants for IP address list, defined in myspace.h.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17651
diff changeset
154
06d60201e371 Use constants for IP address list, defined in myspace.h.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17651
diff changeset
155 #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"
18895
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
156 #define MSIM_LOGIN_IP_LIST_LEN 25
27155
8cb0f676c70d Fix a few problems with our myspace login response:
Mark Doliner <mark@kingant.net>
parents: 27154
diff changeset
157 #endif /* SEND_OUR_IP_ADDRESSES */
17652
06d60201e371 Use constants for IP address list, defined in myspace.h.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17651
diff changeset
158
17289
73720427b132 Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17286
diff changeset
159 /* Indexes into status string (0|1|2|3|..., but 0 always empty) */
18895
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
160 #define MSIM_STATUS_ORDINAL_EMPTY 0
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
161 #define MSIM_STATUS_ORDINAL_UNKNOWNs 1
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
162 #define MSIM_STATUS_ORDINAL_ONLINE 2
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
163 #define MSIM_STATUS_ORDINAL_UNKNOWNss 3
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
164 #define MSIM_STATUS_ORDINAL_HEADLINE 4
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
165 #define MSIM_STATUS_ORDINAL_UNKNOWNls 5
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
166 #define MSIM_STATUS_ORDINAL_UNKNOWN 6
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
167 #define MSIM_STATUS_ORDINAL_UNKNOWN1 7
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
168 #define MSIM_STATUS_ORDINAL_UNKNOWNp 8
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
169 #define MSIM_STATUS_ORDINAL_UNKNOWN2 9
17289
73720427b132 Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17286
diff changeset
170
17674
e24d44e3b6d2 Recognize online/away status of buddies on buddy list.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17670
diff changeset
171 /* Status codes - states a buddy (or you!) can be in. */
18895
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
172 #define MSIM_STATUS_CODE_OFFLINE_OR_HIDDEN 0
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
173 #define MSIM_STATUS_CODE_ONLINE 1
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
174 #define MSIM_STATUS_CODE_IDLE 2
f732d072b118 Change all code to better match the style of libpurple - use 8-space tabs
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 18881
diff changeset
175 #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
176
19462
105305518622 On login, get contacts from server using msim_get_contact_list().
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19436
diff changeset
177 /* Inbox status bitfield values for MsimSession.inbox_status. */
17948
c23122e0af91 Notify of new inbox messages (friend requests, inbox messages, comments),
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17947
diff changeset
178 #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
179 #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
180 #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
181 #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
182 #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
183
19462
105305518622 On login, get contacts from server using msim_get_contact_list().
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19436
diff changeset
184 /* Codes for msim_got_contact_list(), to tell what to do afterwards. */
105305518622 On login, get contacts from server using msim_get_contact_list().
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19436
diff changeset
185 #define MSIM_CONTACT_LIST_INITIAL_FRIENDS 0
105305518622 On login, get contacts from server using msim_get_contact_list().
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19436
diff changeset
186 #define MSIM_CONTACT_LIST_IMPORT_ALL_FRIENDS 1
105305518622 On login, get contacts from server using msim_get_contact_list().
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19436
diff changeset
187 #define MSIM_CONTACT_LIST_IMPORT_TOP_FRIENDS 2
105305518622 On login, get contacts from server using msim_get_contact_list().
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19436
diff changeset
188
22156
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 22101
diff changeset
189 /* Error codes */
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 22101
diff changeset
190 #define MSIM_ERROR_INCORRECT_PASSWORD 260
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 22101
diff changeset
191 #define MSIM_ERROR_LOGGED_IN_ELSEWHERE 6
17269
57bde8784308 (Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 17266
diff changeset
192
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
193 /* 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
194 gboolean msim_send_raw(MsimSession *session, const gchar *msg);
16405
8063f163f411 Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff changeset
195
19432
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19427
diff changeset
196 gboolean msim_send_bm(MsimSession *session, const gchar *who, const gchar *text, int type);
210f792efd7c In msimprpl, move zap-related code to a separate module.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19427
diff changeset
197
22302
0e2207b46080 In msimprpl, if the user signs in without any username set (this will happen
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 22268
diff changeset
198 gboolean msim_we_are_logged_on(MsimSession *session);
0e2207b46080 In msimprpl, if the user signs in without any username set (this will happen
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 22268
diff changeset
199
19435
bddc6a6fddf0 In msimprpl, move user-related code to a new user module, and move other
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19434
diff changeset
200 void msim_unrecognized(MsimSession *session, MsimMessage *msg, gchar *note);
bddc6a6fddf0 In msimprpl, move user-related code to a new user module, and move other
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19434
diff changeset
201 guint msim_new_reply_callback(MsimSession *session, MSIM_USER_LOOKUP_CB cb, gpointer data);
bddc6a6fddf0 In msimprpl, move user-related code to a new user module, and move other
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19434
diff changeset
202
16735
52357f6392a4 Add partial implementation of MsimMessage (not used anywhere yet).
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 16734
diff changeset
203 #endif /* !_MYSPACE_MYSPACE_H */