Patches item #1621854, was opened at 2006-12-25 04:36 Message generated for change (Comment added) made by bsponline You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=300235&aid=1621854&group_id=235
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Ka-Hing Cheung (bsponline) Assigned to: Sean Egan (seanegan) Summary: brings soc-2006-msnp13 up to head Initial Comment: This tarball brings soc-2006-msnp13 up to head. In addition to that it also fixes a crash with sending offline messages. I wasn't able to generate a diff against that branch, svn seems to insist on diff'ing against HEAD after I run the merge command. After running `svn merge -r 16309:HEAD https://gaim.svn.sourceforge.net/svnroot/gaim/trunk` on the soc-2006-msnp13 you can replace the msn directory with the attached tarball. The fix for offline messaging is on msn.c:901: if (!session->oim) session->oim = msn_oim_new(session) ---------------------------------------------------------------------- >Comment By: Ka-Hing Cheung (bsponline) Date: 2007-03-10 20:39 Message: Logged In: YES user_id=159910 Originator: YES uploaded a diff, this diff is unchanged from the last tarball that I previously uploaded, except that it's against HEAD. This should be a little easier for most people. File Added: msn-p13-merge-head.diff ---------------------------------------------------------------------- Comment By: Ka-Hing Cheung (bsponline) Date: 2007-03-07 07:54 Message: Logged In: YES user_id=159910 Originator: YES Another way is to make a SOAP request whenever the friendly name is set, and set the friendly name every time you sign on, which doesn't fix the reverse list problem, but does allow the friendly name to persist. I already have the first part written. I apologize if my lack of activity wasted you too much time. ---------------------------------------------------------------------- Comment By: Simo Mattila (simom) Date: 2007-03-06 11:22 Message: Logged In: YES user_id=1525231 Originator: NO One way too is to ask full contact list and address book every time (*Changes=NULL in certain function calls), I tried this too, it works but logging in takes some more time. It actually fixes reverse list -problem too, but maybe local caching would still be a better solution as it is planned to work that way and it reduces bandwidth-usage. ---------------------------------------------------------------------- Comment By: Mark Doliner (thekingant) Date: 2007-03-06 07:09 Message: Logged In: YES user_id=20979 Originator: NO Ooh, that's so rockin' ---------------------------------------------------------------------- Comment By: Ka-Hing Cheung (bsponline) Date: 2007-03-06 07:02 Message: Logged In: YES user_id=159910 Originator: YES I found a way to make the server resend the friendly name every time you sign on, but I haven't had the time and motivation to finish that. Hopefully I will find the time to look at your diff this weekend. ---------------------------------------------------------------------- Comment By: Simo Mattila (simom) Date: 2007-03-05 16:43 Message: Logged In: YES user_id=1525231 Originator: NO I fixed the icons by adding "b->proto_data = user;" to msn_userlist_load() in userlist.c (see end of the patch), and Friendly name -issue by caching it to buddylist and using that if it isn't sent by server. This seems to be necessary as server sends only changes in information since last time. Maybe same should be done to reverse list, as now for every buddy in my list i get 'has you: no' in the tooltip. I also prevented own account to be added to buddy list. Patch against msn.tgz v2 (the one dated 2006-12-30 09:17) can be found in http://koti.mbnet.fi/simom/gaim-msnp13/msnp13-friendly-name-and-icons.diff ---------------------------------------------------------------------- Comment By: Ka-Hing Cheung (bsponline) Date: 2006-12-30 18:54 Message: Logged In: YES user_id=159910 Originator: YES I am heading out, but g_return_if_fail(cmd->param_count >= 3) means if the condition cmd->param_count >= 3 fails, the function would return right there. So that part is working as expected. I have no idea why sometimes I get the friendly name and sometimes I don't. ---------------------------------------------------------------------- Comment By: Michele Scandale (skadotnet) Date: 2006-12-30 11:11 Message: Logged In: YES user_id=1678429 Originator: NO The first two connection I receive after last USR TWN command USR <tid> OK <email> 1 0 USR <tid2> <email> <a number of three blocks nnnnnnnnnn.nnnnnnnn.nnnnnnnn> USR <tid2> OK <email> <displayname> The third time the last USR OK command is: USR <tid2> OK <email> <email> I changed nothing in account's setting, I only connected and disconnected for three time. VERY strange. ---------------------------------------------------------------------- Comment By: Michele Scandale (skadotnet) Date: 2006-12-30 11:02 Message: Logged In: YES user_id=1678429 Originator: NO Uhm... I'm trying your updated version... with a new profile.... The first connection, it's all ok... it loads for my contact the right friendly name from server I think because the local alias is different. I disconnected, then reconnected, it's ok also this time; again I disconnect and then reconnect, but at this third time... it doesn't load the friendly name, and all my msn buddies have the same msn icon http://xs210.xs.to/xs210/06525/screenshot1.png. :| ---------------------------------------------------------------------- Comment By: Michele Scandale (skadotnet) Date: 2006-12-30 10:40 Message: Logged In: YES user_id=1678429 Originator: NO And also I see now in prp_cmd method of notification.c your mod... ############### static void prp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) { MsnSession *session = cmdproc->session; const char *type, *value; g_return_if_fail(cmd->param_count >= 3); type = cmd->params[2]; if (cmd->param_count == 4) { value = cmd->params[3]; if (!strcmp(type, "PHH")) msn_user_set_home_phone(session->user, gaim_url_decode(value)); else if (!strcmp(type, "PHW")) msn_user_set_work_phone(session->user, gaim_url_decode(value)); else if (!strcmp(type, "PHM")) msn_user_set_mobile_phone(session->user, gaim_url_decode(value)); } else { if (!strcmp(type, "PHH")) msn_user_set_home_phone(session->user, NULL); else if (!strcmp(type, "PHW")) msn_user_set_work_phone(session->user, NULL); else if (!strcmp(type, "PHM")) msn_user_set_mobile_phone(session->user, NULL); else if (!strcmp(type, "MFM")) { type = cmd->params[1]; gaim_connection_set_display_name( gaim_account_get_connection(session->account), gaim_url_decode(cmd->params[2])); } } } ############################### as third instruction of the void there is g_return_if_fail(cmd->param_count >= 3);, from whati I understand of this void, it stop the void procedure if cmd->param_count >= 3.... but after I see if (cmd->param_count == 4) .... so if it's right the interpretation of g_return_if_fail the condition that follow never happen! And I also thought that was incoerent... and so I changed the integer of values. ---------------------------------------------------------------------- Comment By: Michele Scandale (skadotnet) Date: 2006-12-30 10:33 Message: Logged In: YES user_id=1678429 Originator: NO I added the if (!strcmp(type, "MFN")) { in sync.c and notification.c because it figured out in that files the void prp_cmd... and I thought that was necessary add the parsing of that instruction... that set the nickname. ---------------------------------------------------------------------- Comment By: Ka-Hing Cheung (bsponline) Date: 2006-12-30 07:17 Message: Logged In: YES user_id=159910 Originator: YES new version, fixes some crashes because group_id is char * but in some places it's set to an int (!). skadotnet, I don't understand why you need `if (!strcmp(type, "MFN")) {` in so many places, so I didn't include most of them. I also have different versions of some of your fixes because I already fixed them. Group manipulations may still not work, at least it's not crashing :-) File Added: msn.tgz ---------------------------------------------------------------------- Comment By: Ka-Hing Cheung (bsponline) Date: 2006-12-30 07:03 Message: Logged In: YES user_id=159910 Originator: YES are you sure that setting the friendly name in msn_notification_post_adl() is correct? something is weird, sometimes I get back my own contact information in contact.c:msn_parse_addressbook(), so I can set the display name there, and sometimes I don't. It may have something to do with contact list caching. I will upload a new version soon that fixes lots of compiler warning and some crashes for group manipulations. ---------------------------------------------------------------------- Comment By: Ka-Hing Cheung (bsponline) Date: 2006-12-30 02:38 Message: Logged In: YES user_id=159910 Originator: YES I finally figured out why I couldn't sign on, I was missing a */ so a large block of code was commented out! ---------------------------------------------------------------------- Comment By: Michele Scandale (skadotnet) Date: 2006-12-29 15:35 Message: Logged In: YES user_id=1678429 Originator: NO I link directly the patch file.... http://skadotnet.altervista.org/msn.patch ---------------------------------------------------------------------- Comment By: Michele Scandale (skadotnet) Date: 2006-12-29 15:33 Message: Logged In: YES user_id=1678429 Originator: NO This is the patch file for the first 2 fix, it's not complete because it need the implementation of the field where save the friendly name, now it use local alias as first display name. It persists the problem of buddy icon, I'm sorry but more than this I can't do. Here the patch: ############################################################################################################################################ diff -uN msn.original/msn.c msn/msn.c --- msn.original/msn.c 2006-12-25 03:29:57.000000000 +0100 +++ msn/msn.c 2006-12-29 16:11:15.000000000 +0100 @@ -137,9 +137,10 @@ return; } - msn_cmdproc_send(cmdproc, "REA", "%s %s", - gaim_account_get_username(account), - alias); + if (strlen(alias) > 0) + msn_cmdproc_send(cmdproc, "PRP", "MFN %s", alias); + else + msn_cmdproc_send(cmdproc, "PRP", "MFN %s", gaim_url_encode(gaim_account_get_username(account))); } static void @@ -798,6 +799,9 @@ if (!msn_session_connect(session, host, port, http_method)) gaim_connection_error(gc, _("Failed to connect to server.")); + + // Transitional pointment to local alias. Should be the friendly name saved at every change. + gaim_connection_set_display_name(gc, gaim_account_get_alias(account)); } static void diff -uN msn.original/notification.c msn/notification.c --- msn.original/notification.c 2006-12-25 00:52:23.000000000 +0100 +++ msn/notification.c 2006-12-29 16:11:15.000000000 +0100 @@ -235,8 +235,9 @@ /* authenticate OK */ const char *friendly = gaim_url_decode(cmd->params[3]); - gaim_connection_set_display_name(gc, friendly); - + if (g_ascii_strcasecmp(friendly, "1")) + gaim_connection_set_display_name(gc, friendly); + msn_session_set_login_step(session, MSN_LOGIN_STEP_SYN); // msn_cmdproc_send(cmdproc, "SYN", "%s", "0"); @@ -626,6 +627,29 @@ msn_notification_post_adl(MsnCmdProc *cmdproc,char *payload, int payload_len) { MsnTransaction *trans; + + GaimAccount *account; + account = cmdproc->session->account; + + /* + * TODO: save somewhere the friendly name in accounts file, when a new account is created, + * or it's set empty or equal to local alias. When a command PRP MFN is sent through + * prp_cmd method in notification.c and sync.c the field in xml config file is updated. + * This is loaded after login with gaim_connection_set_display_name(GaimConnection *gc, const char *value) [msn.c:803-804] + * so if we connect throught MSNP8 on USR OK command we overwrite that field, + * if the length isn't equal to "1", else if we connect throught MSNP11 or higher, on USR OK command + * we don't overwrite that field because the params is equals to "1", and throught the command down here + * we set for the first time the saved friendly nickname. + */ + const char *friendly; + friendly = gaim_url_encode(gaim_connection_get_display_name(account->gc)); + + if (strlen(friendly) <= 0) + friendly = gaim_url_encode(gaim_account_get_username(account)); + + msn_cmdproc_send(cmdproc, "PRP", "MFN %s", friendly); + + gaim_debug_info("Ska","Set friendly name as %s\n",gaim_url_decode(friendly)); gaim_debug_info("MaYuan","Send ADL{%s}\n",payload); trans = msn_transaction_new(cmdproc, "ADL","%d",strlen(payload)); @@ -1025,12 +1049,16 @@ g_return_if_fail(cmd->param_count >= 3); - type = cmd->params[2]; + type = cmd->params[1]; - if (cmd->param_count == 4) + if (cmd->param_count == 3) { - value = cmd->params[3]; - if (!strcmp(type, "PHH")) + value = cmd->params[2]; + if (!strcmp(type, "MFN")) { + msn_user_set_friendly_name(session->user, gaim_url_decode(value)); + gaim_connection_set_display_name(session->account->gc, gaim_url_decode(value)); + } + else if (!strcmp(type, "PHH")) msn_user_set_home_phone(session->user, gaim_url_decode(value)); else if (!strcmp(type, "PHW")) msn_user_set_work_phone(session->user, gaim_url_decode(value)); @@ -1039,7 +1067,11 @@ } else { - if (!strcmp(type, "PHH")) + if (!strcmp(type, "MFN")) { + msn_user_set_friendly_name(session->user, NULL); + gaim_connection_set_display_name(session->account->gc, NULL); + } + else if (!strcmp(type, "PHH")) msn_user_set_home_phone(session->user, NULL); else if (!strcmp(type, "PHW")) msn_user_set_work_phone(session->user, NULL); diff -uN msn.original/sync.c msn/sync.c --- msn.original/sync.c 2006-12-25 00:17:41.000000000 +0100 +++ msn/sync.c 2006-12-29 16:11:15.000000000 +0100 @@ -64,7 +64,11 @@ if (cmd->param_count == 2) { - if (!strcmp(type, "PHH")) + if (!strcmp(type, "MFN")) { + msn_user_set_friendly_name(session->user, gaim_url_decode(value)); + gaim_connection_set_display_name(session->account->gc, gaim_url_decode(value)); + } + else if (!strcmp(type, "PHH")) msn_user_set_home_phone(session->user, gaim_url_decode(value)); else if (!strcmp(type, "PHW")) msn_user_set_work_phone(session->user, gaim_url_decode(value)); @@ -73,7 +77,11 @@ } else { - if (!strcmp(type, "PHH")) + if (!strcmp(type, "MFN")) { + msn_user_set_friendly_name(session->user, NULL); + gaim_connection_set_display_name(session->account->gc, NULL); + } + else if (!strcmp(type, "PHH")) msn_user_set_home_phone(session->user, NULL); else if (!strcmp(type, "PHW")) msn_user_set_work_phone(session->user, NULL); ############################################################################################################################################ ---------------------------------------------------------------------- Comment By: Michele Scandale (skadotnet) Date: 2006-12-29 14:05 Message: Logged In: YES user_id=1678429 Originator: NO I'm modifying the fix for second issue, that also set the display name's field when you open the dialog for set alias manually ---------------------------------------------------------------------- Comment By: Michele Scandale (skadotnet) Date: 2006-12-29 11:15 Message: Logged In: YES user_id=1678429 Originator: NO There is also another bug.... all my msn buddies have the same msn icon: this http://xs210.xs.to/xs210/06525/screenshot1.png ---------------------------------------------------------------------- Comment By: Michele Scandale (skadotnet) Date: 2006-12-29 11:09 Message: Logged In: YES user_id=1678429 Originator: NO I don't see any other way to solve this... when login server send the command USR Ok, now there isn't the display name that should be stored on the server.... I've found, I think, the right location to add this command. File notification.c at line 625. From: ##################################### void msn_notification_post_adl(MsnCmdProc *cmdproc,char *payload, int payload_len) { MsnTransaction *trans; gaim_debug_info("MaYuan","Send ADL{%s}\n",payload); trans = msn_transaction_new(cmdproc, "ADL","%d",strlen(payload)); msn_transaction_set_payload(trans, payload, strlen(payload)); msn_cmdproc_send_trans(cmdproc, trans); } ###################################### To: ###################################### void msn_notification_post_adl(MsnCmdProc *cmdproc,char *payload, int payload_len) { MsnTransaction *trans; GaimAccount *account; account = cmdproc->session->account; msn_cmdproc_send(cmdproc,"PRP","MFN %s", gaim_url_encode(gaim_account_get_alias(account))); gaim_debug_info("MaYuan","Send ADL{%s}\n",payload); trans = msn_transaction_new(cmdproc, "ADL","%d",strlen(payload)); msn_transaction_set_payload(trans, payload, strlen(payload)); msn_cmdproc_send_trans(cmdproc, trans); } ################################################ with this fix, now the friendly name is set at startup as the local alias field's value. For the old MSNP8 is still enabled the parsing of USR OK answer to look for the display name... but connecting with MSNP13/14 it finds only the value "1", because server answer with "USR <transid> OK <email-address> 1 0\r\n". The old parser get the fourth parameter... that now is "1", and set it as friendly name... but then arrives another USR OK answer that containst at fourth parameter again the email address, and again it set the friendly name with the email address. Using this fix, before the second USR OK answer it set the friendly name so the second USR OK answer arrives as the old format "USR <transid> OK <email-address> <friendly-name> 0\r\n". There are other things to do, because, now it set the local alias, and when you want manually change the friendly name through the dialog, the value of textbox is "1", I don't know why. ---------------------------------------------------------------------- Comment By: Ka-Hing Cheung (bsponline) Date: 2006-12-28 23:02 Message: Logged In: YES user_id=159910 Originator: YES ya, I thought about that, but then with MSNP8 you can use your friendly name that you set from elsewhere, with this it means you can't anyway, I still need to fix the logon issue before I can do any meaningful work again. ---------------------------------------------------------------------- Comment By: Michele Scandale (skadotnet) Date: 2006-12-28 22:40 Message: Logged In: YES user_id=1678429 Originator: NO For the second "bug", from what I could see from the code, and from msnpiki, it's a change of commands of the protocol. Before the friendly name ad login was recieved form USR command, but now as says http://msnpiki.msnfanatic.com/index.php/MSNP13:Example_Session#Updating_Display_Name after ADL command we need to send a fisrt PRP command to set the friendly name, so we need to save somewhere the nickname. A solution could be use the config file to save this parameter, when the account is created this field is sat as alias field; then ad after sending ADL command to get the contact list, send the first PRP MFN, to set first the nickname with param the value of friendlyname field; and also add a command to save the friendly nickname's value in the setting file, when is modified manually throught the dialog. ---------------------------------------------------------------------- Comment By: Ka-Hing Cheung (bsponline) Date: 2006-12-28 19:21 Message: Logged In: YES user_id=159910 Originator: YES actually I _thought_ I fixed the 2nd issue, turns out now I can't log in anymore :-/ reverting to old gaim code works though, will figure it out later tonight. feel free to take a shot ---------------------------------------------------------------------- Comment By: Ka-Hing Cheung (bsponline) Date: 2006-12-28 18:46 Message: Logged In: YES user_id=159910 Originator: YES I actually have those 2 fixed already, nice job though. ---------------------------------------------------------------------- Comment By: Michele Scandale (skadotnet) Date: 2006-12-28 17:34 Message: Logged In: YES user_id=1678429 Originator: NO I've tried the patch winth gaim svn... it works but there are some problems with the friendly nickname... when I try to set the nickname, it disconnect from msn. I've corrected this problem using the new msn command to set nickname, instead of the obsolate one. ################################################################### --- msn.c.original 2006-12-28 18:30:12.000000000 +0100 +++ msn.c 2006-12-28 18:30:34.000000000 +0100 @@ -137,9 +137,7 @@ return; } - msn_cmdproc_send(cmdproc, "REA", "%s %s", - gaim_account_get_username(account), - alias); + msn_cmdproc_send(cmdproc, "PRP", "MFN %s", alias); } static void ######################################################################### Now I'm going to solve the missed nickname's update on connect. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=300235&aid=1621854&group_id=235 ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Gaim-patches mailing list Gaim-patches@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gaim-patches