comparison libpurple/protocols/myspace/myspace.c @ 17679:608e4b47dfae

Allow setting status to away or online.
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Mon, 02 Jul 2007 07:07:48 +0000
parents 51f54868bbad
children d87916bd1d73
comparison
equal deleted inserted replaced
17678:51f54868bbad 17679:608e4b47dfae
1281 purple_debug_info("msim", "msim_get_info, setting up lookup, user=%s\n", user); 1281 purple_debug_info("msim", "msim_get_info, setting up lookup, user=%s\n", user);
1282 1282
1283 msim_lookup_user(session, user_to_lookup, msim_get_info_cb, user_msg); 1283 msim_lookup_user(session, user_to_lookup, msim_get_info_cb, user_msg);
1284 1284
1285 g_free(user_to_lookup); 1285 g_free(user_to_lookup);
1286 }
1287
1288 /* Set your status. */
1289 /* TODO: set status to online, when go online, if not invisible? */
1290 void
1291 msim_set_status(PurpleAccount *account, PurpleStatus *status)
1292 {
1293 PurpleStatusType *type;
1294 guint status_code;
1295 MsimSession *session;
1296
1297 session = (MsimSession *)account->gc->proto_data;
1298
1299 type = purple_status_get_type(status);
1300
1301 switch (purple_status_type_get_primitive(type))
1302 {
1303 case PURPLE_STATUS_AVAILABLE:
1304 status_code = MSIM_STATUS_CODE_ONLINE;
1305 break;
1306
1307 #if 0
1308 case PURPLE_STATUS_INVISIBLE:
1309 status_code = MSIM_STATUS_CODE_HIDDEN;
1310 break;
1311 #endif
1312
1313 case PURPLE_STATUS_AWAY:
1314 status_code = MSIM_STATUS_CODE_AWAY;
1315 break;
1316
1317 default:
1318 purple_debug_info("msim", "msim_set_status: unknown "
1319 "status interpreting as online");
1320 status_code = MSIM_STATUS_CODE_ONLINE;
1321 break;
1322 }
1323
1324 if (!msim_send(session,
1325 "status", MSIM_TYPE_INTEGER, status_code,
1326 "sesskey", MSIM_TYPE_INTEGER, session->sesskey,
1327 "statstring", MSIM_TYPE_STRING, g_strdup(""),
1328 "locstring", MSIM_TYPE_STRING, g_strdup("")))
1329 {
1330 purple_debug_info("msim", "msim_set_status: failed to set status");
1331 }
1332
1286 } 1333 }
1287 1334
1288 /** After a uid is resolved to username, tag it with the username and submit for processing. 1335 /** After a uid is resolved to username, tag it with the username and submit for processing.
1289 * 1336 *
1290 * @param session 1337 * @param session
2666 msim_close, /* close */ 2713 msim_close, /* close */
2667 msim_send_im, /* send_im */ 2714 msim_send_im, /* send_im */
2668 NULL, /* set_info */ 2715 NULL, /* set_info */
2669 msim_send_typing, /* send_typing */ 2716 msim_send_typing, /* send_typing */
2670 msim_get_info, /* get_info */ 2717 msim_get_info, /* get_info */
2671 NULL, /* set_away */ 2718 msim_set_status, /* set_status */
2672 NULL, /* set_idle */ 2719 NULL, /* set_idle */
2673 NULL, /* change_passwd */ 2720 NULL, /* change_passwd */
2674 msim_add_buddy, /* add_buddy */ 2721 msim_add_buddy, /* add_buddy */
2675 NULL, /* add_buddies */ 2722 NULL, /* add_buddies */
2676 msim_remove_buddy, /* remove_buddy */ 2723 msim_remove_buddy, /* remove_buddy */