| 83 #define MSIM_PORT 1863 /* TODO: alternate ports and automatic */ |
83 #define MSIM_PORT 1863 /* TODO: alternate ports and automatic */ |
| 84 |
84 |
| 85 /* Constants */ |
85 /* Constants */ |
| 86 #define HASH_SIZE 0x14 /**< Size of SHA-1 hash for login */ |
86 #define HASH_SIZE 0x14 /**< Size of SHA-1 hash for login */ |
| 87 #define NONCE_SIZE 0x20 /**< Half of decoded 'nc' field */ |
87 #define NONCE_SIZE 0x20 /**< Half of decoded 'nc' field */ |
| 88 #define MSIM_READ_BUF_SIZE 5*1024 /**< Receive buffer size */ |
88 #define MSIM_READ_BUF_SIZE 5 * 1024 /**< Receive buffer size */ |
| 89 #define MSIM_FINAL_STRING "\\final\\" /**< Message end marker */ |
89 #define MSIM_FINAL_STRING "\\final\\" /**< Message end marker */ |
| 90 |
90 |
| 91 /* Messages */ |
91 /* Messages */ |
| 92 #define MSIM_BM_INSTANT 1 |
92 #define MSIM_BM_INSTANT 1 |
| 93 #define MSIM_BM_STATUS 100 |
93 #define MSIM_BM_STATUS 100 |
| 94 #define MSIM_BM_ACTION 121 |
94 #define MSIM_BM_ACTION 121 |
| 95 /*#define MSIM_BM_UNKNOWN1 122*/ |
95 /* #define MSIM_BM_UNKNOWN1 122 */ |
| 96 |
96 |
| 97 /* Authentication algorithm for login2 */ |
97 /* Authentication algorithm for login2 */ |
| 98 #define MSIM_AUTH_ALGORITHM 196610 |
98 #define MSIM_AUTH_ALGORITHM 196610 |
| 99 |
99 |
| 100 /* Random number in every MsimSession, to ensure it is valid. */ |
100 /* Random number in every MsimSession, to ensure it is valid. */ |
| 144 const gchar *msim_list_icon(PurpleAccount *acct, PurpleBuddy *buddy); |
144 const gchar *msim_list_icon(PurpleAccount *acct, PurpleBuddy *buddy); |
| 145 |
145 |
| 146 /* TODO: move these three functions to message.c/h */ |
146 /* TODO: move these three functions to message.c/h */ |
| 147 gchar *msim_unescape(const gchar *msg); |
147 gchar *msim_unescape(const gchar *msg); |
| 148 gchar *msim_escape(const gchar *msg); |
148 gchar *msim_escape(const gchar *msg); |
| 149 gchar *str_replace(const gchar* str, const gchar *old, const gchar *new); |
149 gchar *str_replace(const gchar *str, const gchar *old, const gchar *new); |
| 150 |
150 |
| 151 GHashTable *msim_parse(gchar* msg); |
151 GHashTable *msim_parse(gchar *msg); |
| 152 GHashTable* msim_parse_body(const gchar *body_str); |
152 GHashTable *msim_parse_body(const gchar *body_str); |
| 153 |
153 |
| 154 void print_hash_item(gpointer key, gpointer value, gpointer user_data); |
154 void print_hash_item(gpointer key, gpointer value, gpointer user_data); |
| 155 gboolean msim_send_raw(MsimSession *session, const gchar *msg); |
155 gboolean msim_send_raw(MsimSession *session, const gchar *msg); |
| 156 gchar *msim_pack(GHashTable *table); |
156 gchar *msim_pack(GHashTable *table); |
| 157 gboolean msim_sendh(MsimSession *session, GHashTable *table); |
157 gboolean msim_sendh(MsimSession *session, GHashTable *table); |
| 158 gboolean msim_send(MsimSession *session, ...); |
158 gboolean msim_send(MsimSession *session, ...); |
| 159 |
159 |
| 160 void msim_login(PurpleAccount *acct); |
160 void msim_login(PurpleAccount *acct); |
| 161 int msim_login_challenge(MsimSession *session, GHashTable *table); |
161 int msim_login_challenge(MsimSession *session, GHashTable *table); |
| 162 gchar* msim_compute_login_response(guchar nonce[2*NONCE_SIZE], |
162 gchar *msim_compute_login_response(guchar nonce[2 * NONCE_SIZE], |
| 163 gchar* email, gchar* password, guint *response_len); |
163 gchar *email, gchar *password, guint *response_len); |
| 164 |
164 |
| 165 int msim_send_im(PurpleConnection *gc, const char *who, |
165 int msim_send_im(PurpleConnection *gc, const char *who, |
| 166 const char *message, PurpleMessageFlags flags); |
166 const char *message, PurpleMessageFlags flags); |
| 167 int msim_send_im_by_userid(MsimSession *session, const gchar *userid, |
167 int msim_send_im_by_userid(MsimSession *session, const gchar *userid, |
| 168 const gchar *message, PurpleMessageFlags flags); |
168 const gchar *message, PurpleMessageFlags flags); |