comparison libpurple/protocols/msn/msn.c @ 30685:dd430f788bdc

Allow setting the name of the current location. The default is still Pidgin because I have no idea how to determine the "Computer Description" that the official client uses by default (and I'm not even sure it exists on all platforms).
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Tue, 15 Dec 2009 03:58:03 +0000
parents 23f6f80f45ed
children 3d34a0870920
comparison
equal deleted inserted replaced
30684:b4dc2d27f24e 30685:dd430f788bdc
357 purple_connection_get_account(gc), NULL, NULL, 357 purple_connection_get_account(gc), NULL, NULL,
358 gc); 358 gc);
359 } 359 }
360 360
361 static void 361 static void
362 set_endpoint_cb(PurpleConnection *pc, const char *entry)
363 {
364 MsnSession *session;
365 PurpleAccount *account;
366
367 session = purple_connection_get_protocol_data(pc);
368 account = purple_connection_get_account(pc);
369
370 /* Empty endpoint names are not allowed */
371 if (!entry || !*entry)
372 return;
373
374 purple_account_set_string(account, "endpoint-name", entry);
375 msn_notification_send_uux_private_endpointdata(session);
376 }
377
378 static void
379 msn_show_set_endpoint_name(PurplePluginAction *action)
380 {
381 PurpleConnection *pc;
382 PurpleAccount *account;
383
384 pc = (PurpleConnection *)action->context;
385 account = purple_connection_get_account(pc);
386
387 purple_request_input(pc, NULL, _("Set your location name."),
388 _("This is the name that identifies this location."),
389 purple_account_get_string(account, "endpoint-name", NULL),
390 FALSE, FALSE, NULL,
391 _("OK"), G_CALLBACK(set_endpoint_cb),
392 _("Cancel"), NULL,
393 account, NULL, NULL,
394 pc);
395 }
396
397 static void
362 msn_show_set_home_phone(PurplePluginAction *action) 398 msn_show_set_home_phone(PurplePluginAction *action)
363 { 399 {
364 PurpleConnection *gc; 400 PurpleConnection *gc;
365 MsnSession *session; 401 MsnSession *session;
366 402
929 act = purple_plugin_action_new(_("Set Friendly Name..."), 965 act = purple_plugin_action_new(_("Set Friendly Name..."),
930 msn_show_set_friendly_name); 966 msn_show_set_friendly_name);
931 m = g_list_append(m, act); 967 m = g_list_append(m, act);
932 m = g_list_append(m, NULL); 968 m = g_list_append(m, NULL);
933 969
970 act = purple_plugin_action_new(_("Set Location Name..."),
971 msn_show_set_endpoint_name);
972 m = g_list_append(m, act);
973 m = g_list_append(m, NULL);
974
934 act = purple_plugin_action_new(_("Set Home Phone Number..."), 975 act = purple_plugin_action_new(_("Set Home Phone Number..."),
935 msn_show_set_home_phone); 976 msn_show_set_home_phone);
936 m = g_list_append(m, act); 977 m = g_list_append(m, act);
937 978
938 act = purple_plugin_action_new(_("Set Work Phone Number..."), 979 act = purple_plugin_action_new(_("Set Work Phone Number..."),
1062 if (strcmp(username, purple_account_get_username(account))) 1103 if (strcmp(username, purple_account_get_username(account)))
1063 purple_account_set_username(account, username); 1104 purple_account_set_username(account, username);
1064 1105
1065 username = purple_account_get_string(account, "display-name", NULL); 1106 username = purple_account_get_string(account, "display-name", NULL);
1066 purple_connection_set_display_name(gc, username); 1107 purple_connection_set_display_name(gc, username);
1108
1109 if (purple_account_get_string(account, "endpoint-name", NULL) == NULL) {
1110 purple_account_set_string(account, "endpoint-name", "Pidgin");
1111 }
1067 1112
1068 if (!msn_session_connect(session, host, port, http_method)) 1113 if (!msn_session_connect(session, host, port, http_method))
1069 purple_connection_error_reason(gc, 1114 purple_connection_error_reason(gc,
1070 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, 1115 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
1071 _("Unable to connect")); 1116 _("Unable to connect"));