comparison libpurple/protocols/msn/switchboard.c @ 15823:32c366eeeb99

sed -ie 's/gaim/purple/g'
author Sean Egan <seanegan@gmail.com>
date Mon, 19 Mar 2007 07:01:17 +0000
parents 5fe8042783c1
children e058328dc954
comparison
equal deleted inserted replaced
15822:84b0f9b23ede 15823:32c366eeeb99
1 /** 1 /**
2 * @file switchboard.c MSN switchboard functions 2 * @file switchboard.c MSN switchboard functions
3 * 3 *
4 * gaim 4 * purple
5 * 5 *
6 * Gaim is the legal property of its developers, whose names are too numerous 6 * Purple is the legal property of its developers, whose names are too numerous
7 * to list here. Please refer to the COPYRIGHT file distributed with this 7 * to list here. Please refer to the COPYRIGHT file distributed with this
8 * source distribution. 8 * source distribution.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
69 MsnSession *session; 69 MsnSession *session;
70 MsnMessage *msg; 70 MsnMessage *msg;
71 GList *l; 71 GList *l;
72 72
73 #ifdef MSN_DEBUG_SB 73 #ifdef MSN_DEBUG_SB
74 gaim_debug_info("msn", "switchboard_destroy: swboard(%p)\n", swboard); 74 purple_debug_info("msn", "switchboard_destroy: swboard(%p)\n", swboard);
75 #endif 75 #endif
76 76
77 g_return_if_fail(swboard != NULL); 77 g_return_if_fail(swboard != NULL);
78 78
79 if (swboard->destroying) 79 if (swboard->destroying)
203 203
204 static void 204 static void
205 msn_switchboard_add_user(MsnSwitchBoard *swboard, const char *user) 205 msn_switchboard_add_user(MsnSwitchBoard *swboard, const char *user)
206 { 206 {
207 MsnCmdProc *cmdproc; 207 MsnCmdProc *cmdproc;
208 GaimAccount *account; 208 PurpleAccount *account;
209 209
210 g_return_if_fail(swboard != NULL); 210 g_return_if_fail(swboard != NULL);
211 211
212 cmdproc = swboard->cmdproc; 212 cmdproc = swboard->cmdproc;
213 account = cmdproc->session->account; 213 account = cmdproc->session->account;
215 swboard->users = g_list_prepend(swboard->users, g_strdup(user)); 215 swboard->users = g_list_prepend(swboard->users, g_strdup(user));
216 swboard->current_users++; 216 swboard->current_users++;
217 swboard->empty = FALSE; 217 swboard->empty = FALSE;
218 218
219 #ifdef MSN_DEBUG_CHAT 219 #ifdef MSN_DEBUG_CHAT
220 gaim_debug_info("msn", "user=[%s], total=%d\n", user, 220 purple_debug_info("msn", "user=[%s], total=%d\n", user,
221 swboard->current_users); 221 swboard->current_users);
222 #endif 222 #endif
223 223
224 if (!(swboard->flag & MSN_SB_FLAG_IM) && (swboard->conv != NULL)) 224 if (!(swboard->flag & MSN_SB_FLAG_IM) && (swboard->conv != NULL))
225 { 225 {
226 /* This is a helper switchboard. */ 226 /* This is a helper switchboard. */
227 gaim_debug_error("msn", "switchboard_add_user: conv != NULL\n"); 227 purple_debug_error("msn", "switchboard_add_user: conv != NULL\n");
228 return; 228 return;
229 } 229 }
230 230
231 if ((swboard->conv != NULL) && 231 if ((swboard->conv != NULL) &&
232 (gaim_conversation_get_type(swboard->conv) == GAIM_CONV_TYPE_CHAT)) 232 (purple_conversation_get_type(swboard->conv) == PURPLE_CONV_TYPE_CHAT))
233 { 233 {
234 gaim_conv_chat_add_user(GAIM_CONV_CHAT(swboard->conv), user, NULL, 234 purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv), user, NULL,
235 GAIM_CBFLAGS_NONE, TRUE); 235 PURPLE_CBFLAGS_NONE, TRUE);
236 } 236 }
237 else if (swboard->current_users > 1 || swboard->total_users > 1) 237 else if (swboard->current_users > 1 || swboard->total_users > 1)
238 { 238 {
239 if (swboard->conv == NULL || 239 if (swboard->conv == NULL ||
240 gaim_conversation_get_type(swboard->conv) != GAIM_CONV_TYPE_CHAT) 240 purple_conversation_get_type(swboard->conv) != PURPLE_CONV_TYPE_CHAT)
241 { 241 {
242 GList *l; 242 GList *l;
243 243
244 #ifdef MSN_DEBUG_CHAT 244 #ifdef MSN_DEBUG_CHAT
245 gaim_debug_info("msn", "[chat] Switching to chat.\n"); 245 purple_debug_info("msn", "[chat] Switching to chat.\n");
246 #endif 246 #endif
247 247
248 #if 0 248 #if 0
249 /* this is bad - it causes msn_switchboard_close to be called on the 249 /* this is bad - it causes msn_switchboard_close to be called on the
250 * switchboard we're in the middle of using :( */ 250 * switchboard we're in the middle of using :( */
251 if (swboard->conv != NULL) 251 if (swboard->conv != NULL)
252 gaim_conversation_destroy(swboard->conv); 252 purple_conversation_destroy(swboard->conv);
253 #endif 253 #endif
254 254
255 swboard->chat_id = cmdproc->session->conv_seq++; 255 swboard->chat_id = cmdproc->session->conv_seq++;
256 swboard->flag |= MSN_SB_FLAG_IM; 256 swboard->flag |= MSN_SB_FLAG_IM;
257 swboard->conv = serv_got_joined_chat(account->gc, 257 swboard->conv = serv_got_joined_chat(account->gc,
263 const char *tmp_user; 263 const char *tmp_user;
264 264
265 tmp_user = l->data; 265 tmp_user = l->data;
266 266
267 #ifdef MSN_DEBUG_CHAT 267 #ifdef MSN_DEBUG_CHAT
268 gaim_debug_info("msn", "[chat] Adding [%s].\n", tmp_user); 268 purple_debug_info("msn", "[chat] Adding [%s].\n", tmp_user);
269 #endif 269 #endif
270 270
271 gaim_conv_chat_add_user(GAIM_CONV_CHAT(swboard->conv), 271 purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv),
272 tmp_user, NULL, GAIM_CBFLAGS_NONE, TRUE); 272 tmp_user, NULL, PURPLE_CBFLAGS_NONE, TRUE);
273 } 273 }
274 274
275 #ifdef MSN_DEBUG_CHAT 275 #ifdef MSN_DEBUG_CHAT
276 gaim_debug_info("msn", "[chat] We add ourselves.\n"); 276 purple_debug_info("msn", "[chat] We add ourselves.\n");
277 #endif 277 #endif
278 278
279 gaim_conv_chat_add_user(GAIM_CONV_CHAT(swboard->conv), 279 purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv),
280 gaim_account_get_username(account), 280 purple_account_get_username(account),
281 NULL, GAIM_CBFLAGS_NONE, TRUE); 281 NULL, PURPLE_CBFLAGS_NONE, TRUE);
282 282
283 g_free(swboard->im_user); 283 g_free(swboard->im_user);
284 swboard->im_user = NULL; 284 swboard->im_user = NULL;
285 } 285 }
286 } 286 }
287 else if (swboard->conv == NULL) 287 else if (swboard->conv == NULL)
288 { 288 {
289 swboard->conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, 289 swboard->conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM,
290 user, account); 290 user, account);
291 } 291 }
292 else 292 else
293 { 293 {
294 gaim_debug_warning("msn", "switchboard_add_user: This should not happen!\n"); 294 purple_debug_warning("msn", "switchboard_add_user: This should not happen!\n");
295 } 295 }
296 } 296 }
297 297
298 static GaimConversation * 298 static PurpleConversation *
299 msn_switchboard_get_conv(MsnSwitchBoard *swboard) 299 msn_switchboard_get_conv(MsnSwitchBoard *swboard)
300 { 300 {
301 GaimAccount *account; 301 PurpleAccount *account;
302 302
303 g_return_val_if_fail(swboard != NULL, NULL); 303 g_return_val_if_fail(swboard != NULL, NULL);
304 304
305 if (swboard->conv != NULL) 305 if (swboard->conv != NULL)
306 return swboard->conv; 306 return swboard->conv;
307 307
308 gaim_debug_error("msn", "Switchboard with unassigned conversation\n"); 308 purple_debug_error("msn", "Switchboard with unassigned conversation\n");
309 309
310 account = swboard->session->account; 310 account = swboard->session->account;
311 311
312 return (swboard->conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, 312 return (swboard->conv = purple_conversation_new(PURPLE_CONV_TYPE_IM,
313 account, swboard->im_user)); 313 account, swboard->im_user));
314 } 314 }
315 315
316 static void 316 static void
317 msn_switchboard_report_user(MsnSwitchBoard *swboard, GaimMessageFlags flags, const char *msg) 317 msn_switchboard_report_user(MsnSwitchBoard *swboard, PurpleMessageFlags flags, const char *msg)
318 { 318 {
319 GaimConversation *conv; 319 PurpleConversation *conv;
320 320
321 g_return_if_fail(swboard != NULL); 321 g_return_if_fail(swboard != NULL);
322 g_return_if_fail(msg != NULL); 322 g_return_if_fail(msg != NULL);
323 323
324 if ((conv = msn_switchboard_get_conv(swboard)) != NULL) 324 if ((conv = msn_switchboard_get_conv(swboard)) != NULL)
325 { 325 {
326 gaim_conversation_write(conv, NULL, msg, flags, time(NULL)); 326 purple_conversation_write(conv, NULL, msg, flags, time(NULL));
327 } 327 }
328 } 328 }
329 329
330 static void 330 static void
331 swboard_error_helper(MsnSwitchBoard *swboard, int reason, const char *passport) 331 swboard_error_helper(MsnSwitchBoard *swboard, int reason, const char *passport)
332 { 332 {
333 g_return_if_fail(swboard != NULL); 333 g_return_if_fail(swboard != NULL);
334 334
335 gaim_debug_warning("msg", "Error: Unable to call the user %s for reason %i\n", 335 purple_debug_warning("msg", "Error: Unable to call the user %s for reason %i\n",
336 passport ? passport : "(null)", reason); 336 passport ? passport : "(null)", reason);
337 337
338 /* TODO: if current_users > 0, this is probably a chat and an invite failed, 338 /* TODO: if current_users > 0, this is probably a chat and an invite failed,
339 * we should report that in the chat or something */ 339 * we should report that in the chat or something */
340 if (swboard->current_users == 0) 340 if (swboard->current_users == 0)
355 355
356 passport = params[0]; 356 passport = params[0];
357 357
358 swboard = trans->data; 358 swboard = trans->data;
359 359
360 gaim_debug_warning("msn", "cal_error_helper: command %s failed for reason %i\n",trans->command,reason); 360 purple_debug_warning("msn", "cal_error_helper: command %s failed for reason %i\n",trans->command,reason);
361 361
362 swboard_error_helper(swboard, reason, passport); 362 swboard_error_helper(swboard, reason, passport);
363 363
364 g_strfreev(params); 364 g_strfreev(params);
365 } 365 }
443 body_enc ? body_enc : "", post ? post : ""); 443 body_enc ? body_enc : "", post ? post : "");
444 g_free(body_enc); 444 g_free(body_enc);
445 g_free(pre); 445 g_free(pre);
446 g_free(post); 446 g_free(post);
447 447
448 msn_switchboard_report_user(swboard, GAIM_MESSAGE_ERROR, 448 msn_switchboard_report_user(swboard, PURPLE_MESSAGE_ERROR,
449 str_reason); 449 str_reason);
450 msn_switchboard_report_user(swboard, GAIM_MESSAGE_RAW, 450 msn_switchboard_report_user(swboard, PURPLE_MESSAGE_RAW,
451 body_str); 451 body_str);
452 452
453 g_free(body_str); 453 g_free(body_str);
454 } 454 }
455 455
570 queue_msg(MsnSwitchBoard *swboard, MsnMessage *msg) 570 queue_msg(MsnSwitchBoard *swboard, MsnMessage *msg)
571 { 571 {
572 g_return_if_fail(swboard != NULL); 572 g_return_if_fail(swboard != NULL);
573 g_return_if_fail(msg != NULL); 573 g_return_if_fail(msg != NULL);
574 574
575 gaim_debug_info("msn", "Appending message to queue.\n"); 575 purple_debug_info("msn", "Appending message to queue.\n");
576 576
577 g_queue_push_tail(swboard->msg_queue, msg); 577 g_queue_push_tail(swboard->msg_queue, msg);
578 578
579 msn_message_ref(msg); 579 msn_message_ref(msg);
580 } 580 }
584 { 584 {
585 MsnMessage *msg; 585 MsnMessage *msg;
586 586
587 g_return_if_fail(swboard != NULL); 587 g_return_if_fail(swboard != NULL);
588 588
589 gaim_debug_info("msn", "Processing queue\n"); 589 purple_debug_info("msn", "Processing queue\n");
590 590
591 while ((msg = g_queue_pop_head(swboard->msg_queue)) != NULL) 591 while ((msg = g_queue_pop_head(swboard->msg_queue)) != NULL)
592 { 592 {
593 gaim_debug_info("msn", "Sending message\n"); 593 purple_debug_info("msn", "Sending message\n");
594 release_msg(swboard, msg); 594 release_msg(swboard, msg);
595 msn_message_unref(msg); 595 msn_message_unref(msg);
596 } 596 }
597 } 597 }
598 598
645 /* cmdproc->data is set to NULL when the switchboard is destroyed; 645 /* cmdproc->data is set to NULL when the switchboard is destroyed;
646 * we may get a bye shortly thereafter. */ 646 * we may get a bye shortly thereafter. */
647 g_return_if_fail(swboard != NULL); 647 g_return_if_fail(swboard != NULL);
648 648
649 if (!(swboard->flag & MSN_SB_FLAG_IM) && (swboard->conv != NULL)) 649 if (!(swboard->flag & MSN_SB_FLAG_IM) && (swboard->conv != NULL))
650 gaim_debug_error("msn_switchboard", "bye_cmd: helper bug\n"); 650 purple_debug_error("msn_switchboard", "bye_cmd: helper bug\n");
651 651
652 if (swboard->conv == NULL) 652 if (swboard->conv == NULL)
653 { 653 {
654 /* This is a helper switchboard */ 654 /* This is a helper switchboard */
655 msn_switchboard_destroy(swboard); 655 msn_switchboard_destroy(swboard);
656 } 656 }
657 else if ((swboard->current_users > 1) || 657 else if ((swboard->current_users > 1) ||
658 (gaim_conversation_get_type(swboard->conv) == GAIM_CONV_TYPE_CHAT)) 658 (purple_conversation_get_type(swboard->conv) == PURPLE_CONV_TYPE_CHAT))
659 { 659 {
660 /* This is a switchboard used for a chat */ 660 /* This is a switchboard used for a chat */
661 gaim_conv_chat_remove_user(GAIM_CONV_CHAT(swboard->conv), user, NULL); 661 purple_conv_chat_remove_user(PURPLE_CONV_CHAT(swboard->conv), user, NULL);
662 swboard->current_users--; 662 swboard->current_users--;
663 if (swboard->current_users == 0) 663 if (swboard->current_users == 0)
664 msn_switchboard_destroy(swboard); 664 msn_switchboard_destroy(swboard);
665 } 665 }
666 else 666 else
671 } 671 }
672 672
673 static void 673 static void
674 iro_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) 674 iro_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
675 { 675 {
676 GaimAccount *account; 676 PurpleAccount *account;
677 GaimConnection *gc; 677 PurpleConnection *gc;
678 MsnSwitchBoard *swboard; 678 MsnSwitchBoard *swboard;
679 679
680 account = cmdproc->session->account; 680 account = cmdproc->session->account;
681 gc = account->gc; 681 gc = account->gc;
682 swboard = cmdproc->data; 682 swboard = cmdproc->data;
688 688
689 static void 689 static void
690 joi_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) 690 joi_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
691 { 691 {
692 MsnSession *session; 692 MsnSession *session;
693 GaimAccount *account; 693 PurpleAccount *account;
694 GaimConnection *gc; 694 PurpleConnection *gc;
695 MsnSwitchBoard *swboard; 695 MsnSwitchBoard *swboard;
696 const char *passport; 696 const char *passport;
697 697
698 passport = cmd->params[0]; 698 passport = cmd->params[0];
699 699
769 } 769 }
770 770
771 static void 771 static void
772 out_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) 772 out_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
773 { 773 {
774 GaimConnection *gc; 774 PurpleConnection *gc;
775 MsnSwitchBoard *swboard; 775 MsnSwitchBoard *swboard;
776 776
777 gc = cmdproc->session->account->gc; 777 gc = cmdproc->session->account->gc;
778 swboard = cmdproc->data; 778 swboard = cmdproc->data;
779 779
810 * Message Handlers 810 * Message Handlers
811 **************************************************************************/ 811 **************************************************************************/
812 static void 812 static void
813 plain_msg(MsnCmdProc *cmdproc, MsnMessage *msg) 813 plain_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
814 { 814 {
815 GaimConnection *gc; 815 PurpleConnection *gc;
816 MsnSwitchBoard *swboard; 816 MsnSwitchBoard *swboard;
817 const char *body; 817 const char *body;
818 char *body_str; 818 char *body_str;
819 char *body_enc; 819 char *body_enc;
820 char *body_final; 820 char *body_final;
839 } 839 }
840 840
841 #if 0 841 #if 0
842 if ((value = msn_message_get_attr(msg, "User-Agent")) != NULL) 842 if ((value = msn_message_get_attr(msg, "User-Agent")) != NULL)
843 { 843 {
844 gaim_debug_misc("msn", "User-Agent = '%s'\n", value); 844 purple_debug_misc("msn", "User-Agent = '%s'\n", value);
845 } 845 }
846 #endif 846 #endif
847 847
848 if ((value = msn_message_get_attr(msg, "X-MMS-IM-Format")) != NULL) 848 if ((value = msn_message_get_attr(msg, "X-MMS-IM-Format")) != NULL)
849 { 849 {
865 865
866 swboard->flag |= MSN_SB_FLAG_IM; 866 swboard->flag |= MSN_SB_FLAG_IM;
867 867
868 if (swboard->current_users > 1 || 868 if (swboard->current_users > 1 ||
869 ((swboard->conv != NULL) && 869 ((swboard->conv != NULL) &&
870 gaim_conversation_get_type(swboard->conv) == GAIM_CONV_TYPE_CHAT)) 870 purple_conversation_get_type(swboard->conv) == PURPLE_CONV_TYPE_CHAT))
871 { 871 {
872 /* If current_users is always ok as it should then there is no need to 872 /* If current_users is always ok as it should then there is no need to
873 * check if this is a chat. */ 873 * check if this is a chat. */
874 if (swboard->current_users <= 1) 874 if (swboard->current_users <= 1)
875 gaim_debug_misc("msn", "plain_msg: current_users(%d)\n", 875 purple_debug_misc("msn", "plain_msg: current_users(%d)\n",
876 swboard->current_users); 876 swboard->current_users);
877 877
878 serv_got_chat_in(gc, swboard->chat_id, passport, 0, body_final, 878 serv_got_chat_in(gc, swboard->chat_id, passport, 0, body_final,
879 time(NULL)); 879 time(NULL));
880 if (swboard->conv == NULL) 880 if (swboard->conv == NULL)
881 { 881 {
882 swboard->conv = gaim_find_chat(gc, swboard->chat_id); 882 swboard->conv = purple_find_chat(gc, swboard->chat_id);
883 swboard->flag |= MSN_SB_FLAG_IM; 883 swboard->flag |= MSN_SB_FLAG_IM;
884 } 884 }
885 } 885 }
886 else 886 else
887 { 887 {
888 serv_got_im(gc, passport, body_final, 0, time(NULL)); 888 serv_got_im(gc, passport, body_final, 0, time(NULL));
889 if (swboard->conv == NULL) 889 if (swboard->conv == NULL)
890 { 890 {
891 swboard->conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, 891 swboard->conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM,
892 passport, gaim_connection_get_account(gc)); 892 passport, purple_connection_get_account(gc));
893 swboard->flag |= MSN_SB_FLAG_IM; 893 swboard->flag |= MSN_SB_FLAG_IM;
894 } 894 }
895 } 895 }
896 896
897 g_free(body_final); 897 g_free(body_final);
898 } 898 }
899 899
900 static void 900 static void
901 control_msg(MsnCmdProc *cmdproc, MsnMessage *msg) 901 control_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
902 { 902 {
903 GaimConnection *gc; 903 PurpleConnection *gc;
904 MsnSwitchBoard *swboard; 904 MsnSwitchBoard *swboard;
905 char *passport; 905 char *passport;
906 906
907 gc = cmdproc->session->account->gc; 907 gc = cmdproc->session->account->gc;
908 swboard = cmdproc->data; 908 swboard = cmdproc->data;
910 910
911 if (swboard->current_users == 1 && 911 if (swboard->current_users == 1 &&
912 msn_message_get_attr(msg, "TypingUser") != NULL) 912 msn_message_get_attr(msg, "TypingUser") != NULL)
913 { 913 {
914 serv_got_typing(gc, passport, MSN_TYPING_RECV_TIMEOUT, 914 serv_got_typing(gc, passport, MSN_TYPING_RECV_TIMEOUT,
915 GAIM_TYPING); 915 PURPLE_TYPING);
916 } 916 }
917 } 917 }
918 918
919 static void 919 static void
920 clientcaps_msg(MsnCmdProc *cmdproc, MsnMessage *msg) 920 clientcaps_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
938 static void 938 static void
939 nudge_msg(MsnCmdProc *cmdproc, MsnMessage *msg) 939 nudge_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
940 { 940 {
941 MsnSwitchBoard *swboard; 941 MsnSwitchBoard *swboard;
942 char *username, *str; 942 char *username, *str;
943 GaimAccount *account; 943 PurpleAccount *account;
944 GaimBuddy *buddy; 944 PurpleBuddy *buddy;
945 const char *user; 945 const char *user;
946 946
947 swboard = cmdproc->data; 947 swboard = cmdproc->data;
948 account = cmdproc->session->account; 948 account = cmdproc->session->account;
949 user = msg->remote_user; 949 user = msg->remote_user;
950 950
951 if ((buddy = gaim_find_buddy(account, user)) != NULL) 951 if ((buddy = purple_find_buddy(account, user)) != NULL)
952 username = g_markup_escape_text(gaim_buddy_get_alias(buddy), -1); 952 username = g_markup_escape_text(purple_buddy_get_alias(buddy), -1);
953 else 953 else
954 username = g_markup_escape_text(user, -1); 954 username = g_markup_escape_text(user, -1);
955 955
956 str = g_strdup_printf(_("%s just sent you a Nudge!"), username); 956 str = g_strdup_printf(_("%s just sent you a Nudge!"), username);
957 g_free(username); 957 g_free(username);
958 msn_switchboard_report_user(swboard, GAIM_MESSAGE_SYSTEM, str); 958 msn_switchboard_report_user(swboard, PURPLE_MESSAGE_SYSTEM, str);
959 g_free(str); 959 g_free(str);
960 } 960 }
961 961
962 /************************************************************************** 962 /**************************************************************************
963 * Connect stuff 963 * Connect stuff
965 static void 965 static void
966 connect_cb(MsnServConn *servconn) 966 connect_cb(MsnServConn *servconn)
967 { 967 {
968 MsnSwitchBoard *swboard; 968 MsnSwitchBoard *swboard;
969 MsnCmdProc *cmdproc; 969 MsnCmdProc *cmdproc;
970 GaimAccount *account; 970 PurpleAccount *account;
971 971
972 cmdproc = servconn->cmdproc; 972 cmdproc = servconn->cmdproc;
973 g_return_if_fail(cmdproc != NULL); 973 g_return_if_fail(cmdproc != NULL);
974 974
975 account = cmdproc->session->account; 975 account = cmdproc->session->account;
979 if (msn_switchboard_is_invited(swboard)) 979 if (msn_switchboard_is_invited(swboard))
980 { 980 {
981 swboard->empty = FALSE; 981 swboard->empty = FALSE;
982 982
983 msn_cmdproc_send(cmdproc, "ANS", "%s %s %s", 983 msn_cmdproc_send(cmdproc, "ANS", "%s %s %s",
984 gaim_account_get_username(account), 984 purple_account_get_username(account),
985 swboard->auth_key, swboard->session_id); 985 swboard->auth_key, swboard->session_id);
986 } 986 }
987 else 987 else
988 { 988 {
989 msn_cmdproc_send(cmdproc, "USR", "%s %s", 989 msn_cmdproc_send(cmdproc, "USR", "%s %s",
990 gaim_account_get_username(account), 990 purple_account_get_username(account),
991 swboard->auth_key); 991 swboard->auth_key);
992 } 992 }
993 } 993 }
994 994
995 static void 995 static void
1043 } 1043 }
1044 1044
1045 static void 1045 static void
1046 cal_timeout(MsnCmdProc *cmdproc, MsnTransaction *trans) 1046 cal_timeout(MsnCmdProc *cmdproc, MsnTransaction *trans)
1047 { 1047 {
1048 gaim_debug_warning("msn", "cal_timeout: command %s timed out\n", trans->command); 1048 purple_debug_warning("msn", "cal_timeout: command %s timed out\n", trans->command);
1049 1049
1050 cal_error_helper(trans, MSN_SB_ERROR_UNKNOWN); 1050 cal_error_helper(trans, MSN_SB_ERROR_UNKNOWN);
1051 } 1051 }
1052 1052
1053 static void 1053 static void
1055 { 1055 {
1056 int reason = MSN_SB_ERROR_UNKNOWN; 1056 int reason = MSN_SB_ERROR_UNKNOWN;
1057 1057
1058 if (error == 215) 1058 if (error == 215)
1059 { 1059 {
1060 gaim_debug_info("msn", "Invited user already in switchboard\n"); 1060 purple_debug_info("msn", "Invited user already in switchboard\n");
1061 return; 1061 return;
1062 } 1062 }
1063 else if (error == 217) 1063 else if (error == 217)
1064 { 1064 {
1065 reason = MSN_SB_ERROR_USER_OFFLINE; 1065 reason = MSN_SB_ERROR_USER_OFFLINE;
1066 } 1066 }
1067 1067
1068 gaim_debug_warning("msn", "cal_error: command %s gave error %i\n", trans->command, error); 1068 purple_debug_warning("msn", "cal_error: command %s gave error %i\n", trans->command, error);
1069 1069
1070 cal_error_helper(trans, reason); 1070 cal_error_helper(trans, reason);
1071 } 1071 }
1072 1072
1073 void 1073 void
1131 else if (error == 800) 1131 else if (error == 800)
1132 reason = MSN_SB_ERROR_TOO_FAST; 1132 reason = MSN_SB_ERROR_TOO_FAST;
1133 1133
1134 swboard = trans->data; 1134 swboard = trans->data;
1135 1135
1136 gaim_debug_info("msn", "xfr_error %i for %s: trans %x, command %s, reason %i\n", 1136 purple_debug_info("msn", "xfr_error %i for %s: trans %x, command %s, reason %i\n",
1137 error, (swboard->im_user ? swboard->im_user : "(null)"), trans, 1137 error, (swboard->im_user ? swboard->im_user : "(null)"), trans,
1138 (trans->command ? trans->command : "(null)"), reason); 1138 (trans->command ? trans->command : "(null)"), reason);
1139 1139
1140 swboard_error_helper(swboard, reason, swboard->im_user); 1140 swboard_error_helper(swboard, reason, swboard->im_user);
1141 } 1141 }