comparison libpurple/protocols/msn/msn.c @ 23495:b82a17934604

fixed a memleak or 3, or maybe 4, or 5. Some of these applies to the p14 code as well
author Ka-Hing Cheung <khc@hxbc.us>
date Wed, 26 Dec 2007 02:30:07 +0000
parents 665e04562de0
children aa25bb450139
comparison
equal deleted inserted replaced
23494:8315e4604226 23495:b82a17934604
925 return 1; 925 return 1;
926 } 926 }
927 } 927 }
928 928
929 msn_import_html(message, &msgformat, &msgtext); 929 msn_import_html(message, &msgformat, &msgtext);
930 if(msn_user_is_online(account, who)|| 930 /* this is incorrect, we should try to initiate a connection to the
931 buddy first, and only falls back if that fails. Otherwise we can
932 only send offline message to invisible buddies */
933 if (msn_user_is_online(account, who)||
931 msn_user_is_yahoo(account, who)){ 934 msn_user_is_yahoo(account, who)){
932 /*User online,then send Online Instant Message*/ 935 /*User online,then send Online Instant Message*/
933 936
934 if (strlen(msgtext) + strlen(msgformat) + strlen(VERSION) > 1564) 937 if (strlen(msgtext) + strlen(msgformat) + strlen(VERSION) > 1564)
935 { 938 {
992 imdata->when = time(NULL); 995 imdata->when = time(NULL);
993 purple_timeout_add(0, msn_send_me_im, imdata); 996 purple_timeout_add(0, msn_send_me_im, imdata);
994 } 997 }
995 998
996 msn_message_destroy(msg); 999 msn_message_destroy(msg);
997 }else { 1000 } else {
998 /*send Offline Instant Message,only to MSN Passport User*/ 1001 /*send Offline Instant Message,only to MSN Passport User*/
999 MsnSession *session; 1002 MsnSession *session;
1000 char *friendname; 1003 char *friendname;
1001 1004
1002 purple_debug_info("MSNP14","prepare to send offline Message\n"); 1005 purple_debug_info("MSNP14","prepare to send offline Message\n");
1003 session = gc->proto_data; 1006 session = gc->proto_data;
1004 1007
1005 friendname = msn_encode_mime(account->username); 1008 friendname = msn_encode_mime(account->username);
1006 msn_oim_prep_send_msg_info(session->oim, 1009 msn_oim_prep_send_msg_info(session->oim,
1007 purple_account_get_username(account), 1010 purple_account_get_username(account),
1008 friendname, who, message); 1011 friendname, who, msgformat);
1009 msn_oim_send_msg(session->oim); 1012 msn_oim_send_msg(session->oim);
1013
1014 g_free(msgformat);
1015 g_free(msgtext);
1010 g_free(friendname); 1016 g_free(friendname);
1011 } 1017 }
1012 1018
1013 return 1; 1019 return 1;
1014 } 1020 }