43
44
session->user = msn_user_new(session->userlist,
44
45
purple_account_get_username(account), NULL);
46
session->oim = msn_oim_new(session);
46
session->protocol_ver = 9;
48
/*if you want to chat with Yahoo Messenger*/
49
//session->protocol_ver = WLM_YAHOO_PROT_VER;
50
session->protocol_ver = WLM_PROT_VER;
47
51
session->conv_seq = 1;
71
75
msn_userlist_destroy(session->userlist);
77
g_free(session->passport_info.t);
78
g_free(session->passport_info.p);
73
79
g_free(session->passport_info.kv);
74
80
g_free(session->passport_info.sid);
75
81
g_free(session->passport_info.mspauth);
87
93
if (session->nexus != NULL)
88
94
msn_nexus_destroy(session->nexus);
96
if (session->contact != NULL)
97
msn_contact_destroy(session->contact);
98
if (session->oim != NULL)
99
msn_oim_destroy(session->oim);
90
101
if (session->user != NULL)
91
102
msn_user_destroy(session->user);
104
if (session->soap_table)
105
g_hash_table_destroy(session->soap_table);
107
if (session->soap_cleanup_handle)
108
purple_timeout_remove(session->soap_cleanup_handle);
176
static PurpleConversation *
177
msn_session_get_conv(MsnSession *session,const char *passport)
179
PurpleAccount *account;
180
PurpleConversation * conv;
182
g_return_val_if_fail(session != NULL, NULL);
183
account = session->account;
185
conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM,
188
conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, passport);
193
/* put Message to User Conversation
195
* passport - the one want to talk to you
198
msn_session_report_user(MsnSession *session,const char *passport,char *msg,PurpleMessageFlags flags)
200
PurpleConversation * conv;
202
if ((conv = msn_session_get_conv(session,passport)) != NULL){
203
purple_conversation_write(conv, NULL, msg, flags, time(NULL));
158
208
msn_session_find_swboard_with_conv(MsnSession *session, PurpleConversation *conv)
230
280
/* The core used to use msn_add_buddy to add all buddies before
231
281
* being logged in. This no longer happens, so we manually iterate
232
* over the whole buddy list to identify sync issues. */
234
for (gnode = purple_blist_get_root(); gnode; gnode = gnode->next) {
282
* over the whole buddy list to identify sync issues.
284
for (gnode = purple_get_blist()->root; gnode; gnode = gnode->next) {
235
285
PurpleGroup *group = (PurpleGroup *)gnode;
236
const char *group_name = group->name;
286
const char *group_name;
237
287
if(!PURPLE_BLIST_NODE_IS_GROUP(gnode))
289
group_name = group->name;
239
290
for(cnode = gnode->child; cnode; cnode = cnode->next) {
240
291
if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode))
253
304
if ((remote_user != NULL) && (remote_user->list_op & MSN_LIST_FL_OP))
258
group_id = msn_userlist_find_group_id(remote_user->userlist,
261
308
for (l = remote_user->group_ids; l != NULL; l = l->next)
263
if (group_id == GPOINTER_TO_INT(l->data))
310
const char *name = msn_userlist_find_group_name(remote_user->userlist, l->data);
311
if (name && !g_strcasecmp(group_name, name))
295
343
case MSN_ERROR_SERVCONN:
344
reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
296
345
msg = g_strdup(info);
298
347
case MSN_ERROR_UNSUPPORTED_PROTOCOL:
348
reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
299
349
msg = g_strdup(_("Our protocol is not supported by the "
302
352
case MSN_ERROR_HTTP_MALFORMED:
353
reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
303
354
msg = g_strdup(_("Error parsing HTTP."));
305
356
case MSN_ERROR_SIGN_OTHER:
306
gc->wants_to_die = TRUE;
357
reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE;
307
358
msg = g_strdup(_("You have signed on from another location."));
359
if (!purple_account_get_remember_password(session->account))
360
purple_account_set_password(session->account, NULL);
309
362
case MSN_ERROR_SERV_UNAVAILABLE:
363
reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
310
364
msg = g_strdup(_("The MSN servers are temporarily "
311
365
"unavailable. Please wait and try "
314
368
case MSN_ERROR_SERV_DOWN:
369
reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
315
370
msg = g_strdup(_("The MSN servers are going down "
316
371
"temporarily."));
318
373
case MSN_ERROR_AUTH:
319
gc->wants_to_die = TRUE;
374
reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
320
375
msg = g_strdup_printf(_("Unable to authenticate: %s"),
321
376
(info == NULL ) ?
322
377
_("Unknown error") : info);
324
379
case MSN_ERROR_BAD_BLIST:
380
reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
325
381
msg = g_strdup(_("Your MSN buddy list is temporarily "
326
382
"unavailable. Please wait and try "
386
reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
330
387
msg = g_strdup(_("Unknown error."));
334
391
msn_session_disconnect(session);
336
purple_connection_error(gc, msg);
393
purple_connection_error_reason (gc, reason, msg);