Mercurial > pidgin.yaz
annotate libpurple/protocols/myspace/myspace.h @ 17905:7b890c79aabf
Add msim_markup_to_html() to convert MySpaceIM-style markup to Purple-compatible
HTML, on incoming messages. So far, the <f> tag is supported, with font face,
size, and bold/italic/underline decoration.
Also add msim_test_xml(), containing experiments in using xmlnode to parse
MySpaceIM markup.
author | Jeffrey Connelly <jaconnel@calpoly.edu> |
---|---|
date | Mon, 25 Jun 2007 04:11:06 +0000 |
parents | cbda7f26d27d |
children | 5c2720824798 |
rev | line source |
---|---|
17343
58b4d103a5b8
Use symbolic constants for persist messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17337
diff
changeset
|
1 /* MySpaceIM Protocol Plugin, header file |
16406
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
2 * |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
3 * Copyright (C) 2007, Jeff Connelly <jeff2@homing.pidgin.im> |
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 |
16746
52357f6392a4
Add partial implementation of MsimMessage (not used anywhere yet).
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16745
diff
changeset
|
20 #ifndef _MYSPACE_MYSPACE_H |
52357f6392a4
Add partial implementation of MsimMessage (not used anywhere yet).
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16745
diff
changeset
|
21 #define _MYSPACE_MYSPACE_H |
52357f6392a4
Add partial implementation of MsimMessage (not used anywhere yet).
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16745
diff
changeset
|
22 |
16747
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16746
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:
16746
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:
16746
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:
16746
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:
16746
diff
changeset
|
27 |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16746
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:
16746
diff
changeset
|
29 |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16746
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:
16746
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:
16746
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:
16746
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:
16746
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:
16746
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:
16746
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:
16746
diff
changeset
|
37 |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16746
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:
16746
diff
changeset
|
39 |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16746
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:
16746
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:
16746
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:
16746
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:
16746
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:
16746
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:
16746
diff
changeset
|
46 #include "debug.h" /* for purple_debug_info */ |
17905
7b890c79aabf
Add msim_markup_to_html() to convert MySpaceIM-style markup to Purple-compatible
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17903
diff
changeset
|
47 #include "xmlnode.h" |
16747
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16746
diff
changeset
|
48 |
17323
793301c04e3a
(Incomplete - plugin does not load) Begin migrating protocol message receiving to MsimMessage.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16749
diff
changeset
|
49 /* MySpaceIM includes */ |
793301c04e3a
(Incomplete - plugin does not load) Begin migrating protocol message receiving to MsimMessage.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16749
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:
16749
diff
changeset
|
51 |
16736
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
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:
16734
diff
changeset
|
53 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
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:
16734
diff
changeset
|
55 #define MSIM_DEBUG_MSG |
16408
bb649c52fc19
Replace printf() in MySpaceIM prpl with purple_debug_info().
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16406
diff
changeset
|
56 /* Low-level and rarely needed */ |
16736
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
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:
16734
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:
16734
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:
16734
diff
changeset
|
60 |
17894
333fe6ac1046
Add msim_unrecognized() to handle unhandled messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17892
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:
17892
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:
17892
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:
17892
diff
changeset
|
64 * you want to actually use the plugin! */ |
333fe6ac1046
Add msim_unrecognized() to handle unhandled messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17892
diff
changeset
|
65 /*#define MSIM_SELF_TEST */ |
333fe6ac1046
Add msim_unrecognized() to handle unhandled messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17892
diff
changeset
|
66 |
16736
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
67 /* RC4 didn't make it into Libpurple 2.0.0's cipher suite, so we have |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
68 * to use our own RC4 code (from Samba) by not defining this. */ |
16748
da7621e799b7
Enable usage of RC4 in libpurple, now that it is in 2.0.1.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16747
diff
changeset
|
69 /* RC4 is in Libpurple 2.0.1, so define this. */ |
da7621e799b7
Enable usage of RC4 in libpurple, now that it is in 2.0.1.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16747
diff
changeset
|
70 #define MSIM_USE_PURPLE_RC4 |
16736
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
71 |
17896
01d7e5096dde
Expand on a couple TODO comments. Current TODO counts:
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17895
diff
changeset
|
72 /* TODO: (one release after) when RC4 makes it into libpurple, use the PURPLE_VERSION_CHECK |
16736
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
73 * macro to conditionally compile. And then later, get rid of our own |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
74 * RC4 code and only support libpurple with RC4. */ |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
75 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
76 /* Constants */ |
16408
bb649c52fc19
Replace printf() in MySpaceIM prpl with purple_debug_info().
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16406
diff
changeset
|
77 |
16406
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
78 /* Build version of MySpaceIM to report to servers (1.0.xxx.0) */ |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
79 #define MSIM_CLIENT_VERSION 673 |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
80 |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
81 /* Server */ |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
82 #define MSIM_SERVER "im.myspace.akadns.net" |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
83 //#define MSIM_SERVER "localhost" |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
84 #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
|
85 |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
86 /* Constants */ |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
87 #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
|
88 #define NONCE_SIZE 0x20 /**< Half of decoded 'nc' field */ |
17332
f3ec513efb59
Parenthesize 5 * 1024, in case the macro expansion occurs within a complex
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17326
diff
changeset
|
89 #define MSIM_READ_BUF_SIZE (5 * 1024) /**< Receive buffer size */ |
16406
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
90 #define MSIM_FINAL_STRING "\\final\\" /**< Message end marker */ |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
91 |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
92 /* Messages */ |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
93 #define MSIM_BM_INSTANT 1 |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
94 #define MSIM_BM_STATUS 100 |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
95 #define MSIM_BM_ACTION 121 |
16749
0fa4a3e9b318
Stylistic improvements - use type *name instead of type* name for pointers
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16748
diff
changeset
|
96 /* #define MSIM_BM_UNKNOWN1 122 */ |
16406
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
97 |
16745
3f53f8f502b2
Replacement magic numbers by symbolic constants.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16743
diff
changeset
|
98 /* Authentication algorithm for login2 */ |
3f53f8f502b2
Replacement magic numbers by symbolic constants.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16743
diff
changeset
|
99 #define MSIM_AUTH_ALGORITHM 196610 |
3f53f8f502b2
Replacement magic numbers by symbolic constants.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16743
diff
changeset
|
100 |
17895
06d60201e371
Use constants for IP address list, defined in myspace.h.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17894
diff
changeset
|
101 /* 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:
17894
diff
changeset
|
102 * 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:
17894
diff
changeset
|
103 * This is not immediately |
06d60201e371
Use constants for IP address list, defined in myspace.h.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17894
diff
changeset
|
104 * 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:
17894
diff
changeset
|
105 * 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:
17894
diff
changeset
|
106 * 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:
17894
diff
changeset
|
107 * 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:
17894
diff
changeset
|
108 * 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:
17894
diff
changeset
|
109 */ |
06d60201e371
Use constants for IP address list, defined in myspace.h.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17894
diff
changeset
|
110 |
06d60201e371
Use constants for IP address list, defined in myspace.h.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17894
diff
changeset
|
111 #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:
17894
diff
changeset
|
112 #define MSIM_LOGIN_IP_LIST_LEN 25 |
06d60201e371
Use constants for IP address list, defined in myspace.h.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17894
diff
changeset
|
113 |
17346
73720427b132
Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17343
diff
changeset
|
114 /* 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:
17343
diff
changeset
|
115 #define MSIM_STATUS_ORDINAL_EMPTY 0 |
73720427b132
Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17343
diff
changeset
|
116 #define MSIM_STATUS_ORDINAL_UNKNOWNs 1 |
73720427b132
Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17343
diff
changeset
|
117 #define MSIM_STATUS_ORDINAL_ONLINE 2 |
73720427b132
Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17343
diff
changeset
|
118 #define MSIM_STATUS_ORDINAL_UNKNOWNss 3 |
73720427b132
Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17343
diff
changeset
|
119 #define MSIM_STATUS_ORDINAL_HEADLINE 4 |
73720427b132
Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17343
diff
changeset
|
120 #define MSIM_STATUS_ORDINAL_UNKNOWNls 5 |
73720427b132
Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17343
diff
changeset
|
121 #define MSIM_STATUS_ORDINAL_UNKNOWN 6 |
73720427b132
Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17343
diff
changeset
|
122 #define MSIM_STATUS_ORDINAL_UNKNOWN1 7 |
73720427b132
Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17343
diff
changeset
|
123 #define MSIM_STATUS_ORDINAL_UNKNOWNp 8 |
73720427b132
Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17343
diff
changeset
|
124 #define MSIM_STATUS_ORDINAL_UNKNOWN2 9 |
73720427b132
Show online buddies on buddy list as online.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17343
diff
changeset
|
125 |
17326
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17323
diff
changeset
|
126 /* Random number in every MsimSession, to ensure it is valid. */ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17323
diff
changeset
|
127 #define MSIM_SESSION_STRUCT_MAGIC 0xe4a6752b |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17323
diff
changeset
|
128 |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17323
diff
changeset
|
129 /* Everything needed to keep track of a session. */ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17323
diff
changeset
|
130 typedef struct _MsimSession |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17323
diff
changeset
|
131 { |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17323
diff
changeset
|
132 guint magic; /**< MSIM_SESSION_STRUCT_MAGIC */ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17323
diff
changeset
|
133 PurpleAccount *account; |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17323
diff
changeset
|
134 PurpleConnection *gc; |
17354
c2208b64bffb
Change MsimSession.sesskey to an integer (used to be a string), now that
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17353
diff
changeset
|
135 guint sesskey; /**< Session key from server */ |
17373
2aff11bb5e72
Several small changes to work towards a working msim_remove_buddy():
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17372
diff
changeset
|
136 guint userid; /**< This user's numeric user ID */ |
17326
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17323
diff
changeset
|
137 gint fd; /**< File descriptor to/from server */ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17323
diff
changeset
|
138 |
17370
7a0061f4845d
Add msim_uid2username_from_blist() to lookup a username by userid, by
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17366
diff
changeset
|
139 /* TODO: Remove. */ |
17326
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17323
diff
changeset
|
140 GHashTable *user_lookup_cb; /**< Username -> userid lookup callback */ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17323
diff
changeset
|
141 GHashTable *user_lookup_cb_data; /**< Username -> userid lookup callback data */ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17323
diff
changeset
|
142 |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17323
diff
changeset
|
143 gchar *rxbuf; /**< Receive buffer */ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17323
diff
changeset
|
144 guint rxoff; /**< Receive buffer offset */ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17323
diff
changeset
|
145 guint next_rid; /**< Next request/response ID */ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17323
diff
changeset
|
146 } MsimSession; |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17323
diff
changeset
|
147 |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17323
diff
changeset
|
148 /* Check if an MsimSession is valid */ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17323
diff
changeset
|
149 #define MSIM_SESSION_VALID(s) (session != NULL && \ |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17323
diff
changeset
|
150 session->magic == MSIM_SESSION_STRUCT_MAGIC) |
57bde8784308
(Plugin loads, but cannot do anything useful)
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17323
diff
changeset
|
151 |
16406
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
152 /* 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
|
153 * initiated from a user lookup. */ |
17337
d3e17c9d16e9
Use MsimMessage for receiving messages everywhere, instead of GHashTable.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17332
diff
changeset
|
154 typedef void (*MSIM_USER_LOOKUP_CB)(MsimSession *session, MsimMessage *userinfo, |
17357
176b1ba4bafe
Remove 'flags' from send_im_cb_struct - it was never needed.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17354
diff
changeset
|
155 gpointer data); |
16406
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
156 |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
157 /* Functions */ |
16747
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16746
diff
changeset
|
158 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:
16746
diff
changeset
|
159 GList *msim_status_types(PurpleAccount *acct); |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16746
diff
changeset
|
160 const gchar *msim_list_icon(PurpleAccount *acct, PurpleBuddy *buddy); |
16406
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
161 |
16746
52357f6392a4
Add partial implementation of MsimMessage (not used anywhere yet).
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16745
diff
changeset
|
162 /* TODO: move these three functions to message.c/h */ |
17892
9cb771adbdea
Refactor msim_escape() & msim_unescape().
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17891
diff
changeset
|
163 gchar *msim_unescape_or_escape(gchar *msg, gboolean escape); |
16747
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16746
diff
changeset
|
164 gchar *msim_unescape(const gchar *msg); |
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16746
diff
changeset
|
165 gchar *msim_escape(const gchar *msg); |
16749
0fa4a3e9b318
Stylistic improvements - use type *name instead of type* name for pointers
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16748
diff
changeset
|
166 gchar *str_replace(const gchar *str, const gchar *old, const gchar *new); |
16746
52357f6392a4
Add partial implementation of MsimMessage (not used anywhere yet).
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16745
diff
changeset
|
167 |
16747
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16746
diff
changeset
|
168 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:
16746
diff
changeset
|
169 gboolean msim_send_raw(MsimSession *session, const gchar *msg); |
17903
cbda7f26d27d
Add a send_raw function, msim_send_really_raw, into the prpl_info struct,
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17899
diff
changeset
|
170 int msim_send_really_raw(PurpleConnection *gc, const char *buf,int total_bytes); |
16406
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
171 |
16747
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16746
diff
changeset
|
172 void msim_login(PurpleAccount *acct); |
17348
d8903e1320a9
Previously, the return value of the processing function and msim_process() told
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17347
diff
changeset
|
173 gboolean msim_login_challenge(MsimSession *session, MsimMessage *msg); |
17383
f057837085b0
Change to use const gchar * where appropriate.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17382
diff
changeset
|
174 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:
17382
diff
changeset
|
175 const gchar *email, const gchar *password, guint *response_len); |
16406
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
176 |
17347
aa8e70fa1edc
Add, but do not use, incomplete functions for using typing notifications.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17346
diff
changeset
|
177 |
17383
f057837085b0
Change to use const gchar * where appropriate.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17382
diff
changeset
|
178 int msim_send_im(PurpleConnection *gc, const gchar *who, const gchar *message, |
17357
176b1ba4bafe
Remove 'flags' from send_im_cb_struct - it was never needed.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17354
diff
changeset
|
179 PurpleMessageFlags flags); |
17383
f057837085b0
Change to use const gchar * where appropriate.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17382
diff
changeset
|
180 gboolean msim_send_bm(MsimSession *session, const gchar *who, const gchar *text, int type); |
17360
ceba4fc06c41
Change msim_send_im_by_userid_cb() to msim_send_im_cb(), and remove
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17357
diff
changeset
|
181 void msim_send_im_cb(MsimSession *session, MsimMessage *userinfo, gpointer data); |
17357
176b1ba4bafe
Remove 'flags' from send_im_cb_struct - it was never needed.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17354
diff
changeset
|
182 |
17894
333fe6ac1046
Add msim_unrecognized() to handle unhandled messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17892
diff
changeset
|
183 void msim_unrecognized(MsimSession *session, MsimMessage *msg, gchar *note); |
333fe6ac1046
Add msim_unrecognized() to handle unhandled messages.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17892
diff
changeset
|
184 |
17905
7b890c79aabf
Add msim_markup_to_html() to convert MySpaceIM-style markup to Purple-compatible
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17903
diff
changeset
|
185 gchar *msim_markup_to_html(const gchar *raw); |
17337
d3e17c9d16e9
Use MsimMessage for receiving messages everywhere, instead of GHashTable.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17332
diff
changeset
|
186 int msim_incoming_im(MsimSession *session, MsimMessage *msg); |
17347
aa8e70fa1edc
Add, but do not use, incomplete functions for using typing notifications.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17346
diff
changeset
|
187 int msim_incoming_action(MsimSession *session, MsimMessage *msg); |
aa8e70fa1edc
Add, but do not use, incomplete functions for using typing notifications.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17346
diff
changeset
|
188 |
17383
f057837085b0
Change to use const gchar * where appropriate.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17382
diff
changeset
|
189 unsigned int msim_send_typing(PurpleConnection *gc, const gchar *name, PurpleTypingState state); |
17899
61f0b36b9891
Retrieve information for profile ("Get Info") from server, instead of from
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17896
diff
changeset
|
190 void msim_get_info_cb(MsimSession *session, MsimMessage *userinfo, gpointer data); |
17383
f057837085b0
Change to use const gchar * where appropriate.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17382
diff
changeset
|
191 void msim_get_info(PurpleConnection *gc, const gchar *name); |
16406
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
192 |
17379
6fa345a01dd8
Show buddy information in tooltip text, and the display name for status text.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17378
diff
changeset
|
193 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:
17378
diff
changeset
|
194 gboolean msim_store_buddy_info(MsimSession *session, MsimMessage *msg); |
17348
d8903e1320a9
Previously, the return value of the processing function and msim_process() told
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17347
diff
changeset
|
195 gboolean msim_process_reply(MsimSession *session, MsimMessage *msg); |
17363
3a02e7db91c7
Add message preprocessing in msim_preprocess_incoming(), to resolve
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17360
diff
changeset
|
196 |
3a02e7db91c7
Add message preprocessing in msim_preprocess_incoming(), to resolve
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17360
diff
changeset
|
197 gboolean msim_preprocess_incoming(MsimSession *session, MsimMessage *msg); |
17366
25a55b52855a
Add, but do not use, two new functions to postprocess outgoing messages
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17364
diff
changeset
|
198 |
17363
3a02e7db91c7
Add message preprocessing in msim_preprocess_incoming(), to resolve
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17360
diff
changeset
|
199 gboolean msim_process(MsimSession *session, MsimMessage *msg); |
16406
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
200 |
17383
f057837085b0
Change to use const gchar * where appropriate.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17382
diff
changeset
|
201 MsimMessage *msim_do_postprocessing(MsimMessage *msg, const gchar *uid_field_name, const gchar *uid_before, guint uid); |
17366
25a55b52855a
Add, but do not use, two new functions to postprocess outgoing messages
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17364
diff
changeset
|
202 void msim_postprocess_outgoing_cb(MsimSession *session, MsimMessage *userinfo, gpointer data); |
17383
f057837085b0
Change to use const gchar * where appropriate.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17382
diff
changeset
|
203 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:
17382
diff
changeset
|
204 const gchar *uid_field_name, const gchar *uid_before); |
17366
25a55b52855a
Add, but do not use, two new functions to postprocess outgoing messages
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17364
diff
changeset
|
205 |
25a55b52855a
Add, but do not use, two new functions to postprocess outgoing messages
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17364
diff
changeset
|
206 |
17348
d8903e1320a9
Previously, the return value of the processing function and msim_process() told
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17347
diff
changeset
|
207 gboolean msim_error(MsimSession *session, MsimMessage *msg); |
d8903e1320a9
Previously, the return value of the processing function and msim_process() told
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17347
diff
changeset
|
208 gboolean msim_status(MsimSession *session, MsimMessage *msg); |
17350
bfda36bd957a
Add incomplete msim_add_buddy() implementation.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17348
diff
changeset
|
209 |
bfda36bd957a
Add incomplete msim_add_buddy() implementation.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17348
diff
changeset
|
210 void msim_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); |
17353
1905859d7a3b
Add (incomplete) msim_remove_buddy().
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17350
diff
changeset
|
211 void msim_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); |
17350
bfda36bd957a
Add incomplete msim_add_buddy() implementation.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17348
diff
changeset
|
212 |
17381
df93e8773981
Add msim_offline_message() for offline message status. Always return TRUE,
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17379
diff
changeset
|
213 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:
17379
diff
changeset
|
214 |
16747
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16746
diff
changeset
|
215 void msim_input_cb(gpointer gc_uncasted, gint source, |
16406
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
216 PurpleInputCondition cond); |
17373
2aff11bb5e72
Several small changes to work towards a working msim_remove_buddy():
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17372
diff
changeset
|
217 |
2aff11bb5e72
Several small changes to work towards a working msim_remove_buddy():
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17372
diff
changeset
|
218 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:
17372
diff
changeset
|
219 |
16747
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16746
diff
changeset
|
220 void msim_connect_cb(gpointer data, gint source, |
16406
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
221 const gchar *error_message); |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
222 |
16747
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16746
diff
changeset
|
223 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:
16746
diff
changeset
|
224 void msim_session_destroy(MsimSession *session); |
16406
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
225 |
16747
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16746
diff
changeset
|
226 void msim_close(PurpleConnection *gc); |
16406
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
227 |
16747
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16746
diff
changeset
|
228 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:
16746
diff
changeset
|
229 gboolean msim_is_email(const gchar *user); |
16406
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
230 |
16747
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16746
diff
changeset
|
231 void msim_lookup_user(MsimSession *session, const gchar *user, |
16406
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
232 MSIM_USER_LOOKUP_CB cb, gpointer data); |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
233 |
16747
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16746
diff
changeset
|
234 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:
16746
diff
changeset
|
235 void msim_tooltip_text(PurpleBuddy *buddy, |
16406
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
236 PurpleNotifyUserInfo *user_info, gboolean full); |
8063f163f411
Add MySpaceIM header file and reorganize functions.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
diff
changeset
|
237 |
17905
7b890c79aabf
Add msim_markup_to_html() to convert MySpaceIM-style markup to Purple-compatible
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17903
diff
changeset
|
238 #ifdef MSIM_SELF_TEST |
7b890c79aabf
Add msim_markup_to_html() to convert MySpaceIM-style markup to Purple-compatible
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17903
diff
changeset
|
239 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:
17903
diff
changeset
|
240 int msim_test_xml(void); |
17891
23f57d36cb65
Add msim_test_all() and related procedures, to perform basic functionality
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17383
diff
changeset
|
241 int msim_test_msg(void); |
23f57d36cb65
Add msim_test_all() and related procedures, to perform basic functionality
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17383
diff
changeset
|
242 int msim_test_escaping(void); |
17905
7b890c79aabf
Add msim_markup_to_html() to convert MySpaceIM-style markup to Purple-compatible
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17903
diff
changeset
|
243 #endif |
17891
23f57d36cb65
Add msim_test_all() and related procedures, to perform basic functionality
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17383
diff
changeset
|
244 |
16747
496855295bd7
Use MsimMessage via msim_send(), instead of msim_send_raw(). This is a more
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16746
diff
changeset
|
245 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:
16746
diff
changeset
|
246 |
17891
23f57d36cb65
Add msim_test_all() and related procedures, to perform basic functionality
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17383
diff
changeset
|
247 |
23f57d36cb65
Add msim_test_all() and related procedures, to perform basic functionality
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17383
diff
changeset
|
248 |
16736
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
249 #ifndef MSIM_USE_PURPLE_RC4 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
250 /* |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
251 Unix SMB/CIFS implementation. |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
252 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
253 a partial implementation of RC4 designed for use in the |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
254 SMB authentication protocol |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
255 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
256 Copyright (C) Andrew Tridgell 1998 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
257 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
258 $Id: crypt-rc4.h 12116 2004-09-27 23:29:22Z guy $ |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
259 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
260 This program is free software; you can redistribute it and/or modify |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
261 it under the terms of the GNU General Public License as published by |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
262 the Free Software Foundation; either version 2 of the License, or |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
263 (at your option) any later version. |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
264 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
265 This program is distributed in the hope that it will be useful, |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
266 but WITHOUT ANY WARRANTY; without even the implied warranty of |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
267 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
268 GNU General Public License for more details. |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
269 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
270 You should have received a copy of the GNU General Public License |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
271 along with this program; if not, write to the Free Software |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
272 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
273 */ |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
274 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
275 typedef struct _rc4_state_struct { |
17383
f057837085b0
Change to use const gchar * where appropriate.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17382
diff
changeset
|
276 guchar s_box[256]; |
f057837085b0
Change to use const gchar * where appropriate.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17382
diff
changeset
|
277 guchar index_i; |
f057837085b0
Change to use const gchar * where appropriate.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17382
diff
changeset
|
278 guchar index_j; |
16736
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
279 } rc4_state_struct; |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
280 |
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
281 void crypt_rc4_init(rc4_state_struct *rc4_state, |
17383
f057837085b0
Change to use const gchar * where appropriate.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17382
diff
changeset
|
282 const guchar *key, int key_len); |
16736
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
283 |
17383
f057837085b0
Change to use const gchar * where appropriate.
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17382
diff
changeset
|
284 void crypt_rc4(rc4_state_struct *rc4_state, guchar *data, int data_len); |
16736
58cd11fcd84f
Re-add RC4 code from Samba, whose use is enabled by not defining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16734
diff
changeset
|
285 #endif /* !MSIM_USE_PURPLE_RC4 */ |
16746
52357f6392a4
Add partial implementation of MsimMessage (not used anywhere yet).
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16745
diff
changeset
|
286 |
17891
23f57d36cb65
Add msim_test_all() and related procedures, to perform basic functionality
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17383
diff
changeset
|
287 |
23f57d36cb65
Add msim_test_all() and related procedures, to perform basic functionality
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
17383
diff
changeset
|
288 |
16746
52357f6392a4
Add partial implementation of MsimMessage (not used anywhere yet).
Jeffrey Connelly <jaconnel@calpoly.edu>
parents:
16745
diff
changeset
|
289 #endif /* !_MYSPACE_MYSPACE_H */ |