comparison libpurple/protocols/oscar/oscar.c @ 15628:2261750cf4e9

Allow setting of the iTunes Music Store URL for AIM accounts. It's similar to your available message. The intention is that you'll have an itms://itunes.com/link?whatever URL for the song you're currently listening to.
author Mark Doliner <mark@kingant.net>
date Tue, 13 Feb 2007 06:58:13 +0000
parents 3548e64b0245
children 5ec709327dc6
comparison
equal deleted inserted replaced
15625:3548e64b0245 15628:2261750cf4e9
3567 3567
3568 static int gaim_bosrights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 3568 static int gaim_bosrights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
3569 GaimConnection *gc; 3569 GaimConnection *gc;
3570 GaimAccount *account; 3570 GaimAccount *account;
3571 GaimStatus *status; 3571 GaimStatus *status;
3572 const char *message; 3572 const char *message, *itmsurl;
3573 char *tmp; 3573 char *tmp;
3574 va_list ap; 3574 va_list ap;
3575 guint16 maxpermits, maxdenies; 3575 guint16 maxpermits, maxdenies;
3576 3576
3577 gc = od->gc; 3577 gc = od->gc;
3603 if (gaim_status_is_available(status)) 3603 if (gaim_status_is_available(status))
3604 message = gaim_status_get_attr_string(status, "message"); 3604 message = gaim_status_get_attr_string(status, "message");
3605 else 3605 else
3606 message = NULL; 3606 message = NULL;
3607 tmp = gaim_markup_strip_html(message); 3607 tmp = gaim_markup_strip_html(message);
3608 aim_srv_setextrainfo(od, FALSE, 0, TRUE, tmp); 3608 itmsurl = gaim_status_get_attr_string(status, "itmsurl");
3609 aim_srv_setextrainfo(od, FALSE, 0, TRUE, tmp, itmsurl);
3609 g_free(tmp); 3610 g_free(tmp);
3610 3611
3611 aim_srv_setidle(od, 0); 3612 aim_srv_setidle(od, 0);
3612 3613
3613 if (od->icq) { 3614 if (od->icq) {
4409 else if (!strcmp(status_id, OSCAR_STATUS_ID_INVISIBLE)) 4410 else if (!strcmp(status_id, OSCAR_STATUS_ID_INVISIBLE))
4410 data |= AIM_ICQ_STATE_INVISIBLE; 4411 data |= AIM_ICQ_STATE_INVISIBLE;
4411 else if (!strcmp(status_id, OSCAR_STATUS_ID_CUSTOM)) 4412 else if (!strcmp(status_id, OSCAR_STATUS_ID_CUSTOM))
4412 data |= AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY; 4413 data |= AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY;
4413 4414
4414 aim_srv_setextrainfo(od, TRUE, data, FALSE, NULL); 4415 aim_srv_setextrainfo(od, TRUE, data, FALSE, NULL, NULL);
4415 } 4416 }
4416 4417
4417 static void 4418 static void
4418 oscar_set_info_and_status(GaimAccount *account, gboolean setinfo, const char *rawinfo, 4419 oscar_set_info_and_status(GaimAccount *account, gboolean setinfo, const char *rawinfo,
4419 gboolean setstatus, GaimStatus *status) 4420 gboolean setstatus, GaimStatus *status)
4475 { 4476 {
4476 /* Do nothing! */ 4477 /* Do nothing! */
4477 } 4478 }
4478 else if (primitive == GAIM_STATUS_AVAILABLE) 4479 else if (primitive == GAIM_STATUS_AVAILABLE)
4479 { 4480 {
4480 const char *status_html; 4481 const char *status_html, *itmsurl;
4481 char *status_text = NULL; 4482 char *status_text = NULL;
4482 4483
4483 status_html = gaim_status_get_attr_string(status, "message"); 4484 status_html = gaim_status_get_attr_string(status, "message");
4484 if (status_html != NULL) 4485 if (status_html != NULL)
4485 { 4486 {
4489 { 4490 {
4490 char *tmp = g_utf8_find_prev_char(status_text, &status_text[58]); 4491 char *tmp = g_utf8_find_prev_char(status_text, &status_text[58]);
4491 strcpy(tmp, "..."); 4492 strcpy(tmp, "...");
4492 } 4493 }
4493 } 4494 }
4494 4495 itmsurl = gaim_status_get_attr_string(status, "itmsurl");
4495 aim_srv_setextrainfo(od, FALSE, 0, TRUE, status_text); 4496
4497 aim_srv_setextrainfo(od, FALSE, 0, TRUE, status_text, itmsurl);
4496 g_free(status_text); 4498 g_free(status_text);
4497 4499
4498 /* This is needed for us to un-set any previous away message. */ 4500 /* This is needed for us to un-set any previous away message. */
4499 away = g_strdup(""); 4501 away = g_strdup("");
4500 } 4502 }
5700 /* Really the available message should only be settable for AIM accounts */ 5702 /* Really the available message should only be settable for AIM accounts */
5701 type = gaim_status_type_new_with_attrs(GAIM_STATUS_AVAILABLE, 5703 type = gaim_status_type_new_with_attrs(GAIM_STATUS_AVAILABLE,
5702 OSCAR_STATUS_ID_AVAILABLE, 5704 OSCAR_STATUS_ID_AVAILABLE,
5703 NULL, TRUE, TRUE, FALSE, 5705 NULL, TRUE, TRUE, FALSE,
5704 "message", _("Message"), 5706 "message", _("Message"),
5707 gaim_value_new(GAIM_TYPE_STRING),
5708 "itmsurl", _("iTunes Music Store Link"),
5705 gaim_value_new(GAIM_TYPE_STRING), NULL); 5709 gaim_value_new(GAIM_TYPE_STRING), NULL);
5706 status_types = g_list_prepend(status_types, type); 5710 status_types = g_list_prepend(status_types, type);
5707 5711
5708 type = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE, 5712 type = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE,
5709 OSCAR_STATUS_ID_FREE4CHAT, 5713 OSCAR_STATUS_ID_FREE4CHAT,