|
From: xevuz <xe...@us...> - 2007-07-14 02:53:29
|
Update of /cvsroot/chix/chix_gaim/src In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv9703/src Modified Files: chix_gaim.c Log Message: various fixes. Index: chix_gaim.c =================================================================== RCS file: /cvsroot/chix/chix_gaim/src/chix_gaim.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- chix_gaim.c 12 Jul 2007 13:55:47 -0000 1.18 +++ chix_gaim.c 14 Jul 2007 02:53:25 -0000 1.19 @@ -193,9 +193,13 @@ ChixMesgBox *inbox = event->data; ChixNode *node; + /* TODO: still dont know how to represent this in pidgin. + * we can't put gui code in here. + */ for (node = inbox->head; node; node = node->next) { ChixMesg *mesg = (ChixMesg *)node; + printf("FROM: %s\n", mesg->buddy->alias); printf("MESG: %s\n", mesg->mesg); } chix_event_done(event); @@ -208,6 +212,8 @@ ChixMesgBox *outbox = event->data; ChixNode *node; + /* TODO: same as above */ + for (node = outbox->head; node; node = node->next) { ChixMesg *mesg = (ChixMesg *)node; @@ -303,21 +309,16 @@ for (node = clist->head; node; node = node->next) { ChixCredit *credit = (ChixCredit *)node; - GList *row = NULL; + GList *row = NULL; + char *provider; - row = g_list_append(row, _(credit->provider)); - row = g_list_append(row, _(credit->alloted)); - row = g_list_append(row, _(credit->used)); - row = g_list_append(row, _(credit->left)); - - /* - * purple_notify_searchresults() frees these pointers - * when we close the dialog box. quick fix for now. - */ - credit->provider = NULL; - credit->alloted = NULL; - credit->used = NULL; - credit->left = NULL; + provider = g_convert(credit->provider, -1, "UTF-8", + "ISO-8859-1", NULL, NULL, NULL); + + row = g_list_append(row, provider); + row = g_list_append(row, g_strdup(credit->alloted)); + row = g_list_append(row, g_strdup(credit->used)); + row = g_list_append(row, g_strdup(credit->left)); purple_notify_searchresults_row_add(results, row); } @@ -396,61 +397,57 @@ return NULL; } -static char * -__status_text(ChixBuddy *buddy) +static void +__status_text(ChixBuddy *buddy, char *buf, int size) { - char buf[16]; + char buf2[16]; - chix_buddy_away_get(buddy, buf, sizeof(buf)); + chix_buddy_away_get(buddy, buf2, sizeof(buf2)); if (CHIX_BUDDY_ON_BOTH(buddy)) - return g_strdup_printf(_("%s %s"), buf, _("(PC/Mobile)")); + g_snprintf(buf, size, _("%s %s"), buf2, _("(PC/Mobile)")); else if (CHIX_BUDDY_ON_PC(buddy)) - return g_strdup_printf(_("%s %s"), buf, _("(PC)")); + g_snprintf(buf, size, _("%s %s"), buf2, _("(PC)")); else if (CHIX_BUDDY_ON_MB(buddy)) - return g_strdup_printf(_("%s %s"), buf, _("(Mobile)")); + g_snprintf(buf, size, _("%s %s"), buf2, _("(Mobile)")); else - return g_strdup_printf(_("%s"), buf); + g_snprintf(buf, size, _("%s"), buf2); } static char * cp_status_text(PurpleBuddy *buddy) { - PurplePresence *pres; - PurpleStatus *stat; - - pres = purple_buddy_get_presence(buddy); - stat = purple_presence_get_active_status(pres); + char buf[64]; if (!buddy->proto_data) return g_strdup(_("Buddy not listed")); - return __status_text(buddy->proto_data); + __status_text(buddy->proto_data, buf, sizeof(buf)); + return g_strdup(buf); } static void cp_tooltip_text(PurpleBuddy *pb, PurpleNotifyUserInfo *ui, gboolean full) { - ChixBuddy *buddy; - char *stat; - char mood[16]; + ChixBuddy *buddy = pb->proto_data; + char stat[64]; + char mood[64]; - if (!pb->proto_data) + if (!buddy) { purple_notify_user_info_add_pair(ui, _("Status"), _("Buddy not listed")); return; } - buddy = pb->proto_data; - stat = __status_text(buddy); + __status_text(buddy, stat, sizeof(stat)); if (CHIX_BUDDY_ON_ANY(buddy)) - purple_notify_user_info_add_pair(ui, _("Status"), stat); + purple_notify_user_info_add_pair(ui, _("Status"), stat); chix_buddy_mood_get(buddy, mood, sizeof(mood)); - purple_notify_user_info_add_pair(ui, _("Mood"), mood); - purple_notify_user_info_add_pair(ui, _("Provider"), buddy->provider); + purple_notify_user_info_add_pair(ui, _("Mood"), mood); - free(stat); + /* is this important for other people? */ + purple_notify_user_info_add_pair(ui, _("Provider"), buddy->provider); } static GList * @@ -597,14 +594,10 @@ if (!buddy) return __unlisted(client, who, mesg); - if ((CHIX_BUDDY_ON_PC(buddy)) || (!strcmp(buddy->provider, "Chikka"))) { - printf("Sending to pc\n"); + if ((CHIX_BUDDY_ON_PC(buddy)) || (!strcmp(buddy->provider, "Chikka"))) return chix_send_mesg(client, buddy, mesg, MESG_TO_PC); - } - else { - printf("Sending to mb\n"); + else return chix_send_mesg(client, buddy, mesg, MESG_TO_MOBILE); - } } static void @@ -632,22 +625,17 @@ { case PURPLE_STATUS_AVAILABLE: chix_client_away_set(client, AWAY_AVAILABLE); - printf("available\n"); break; case PURPLE_STATUS_AWAY: chix_client_away_set(client, AWAY_AWAY); - printf("away\n"); break; case PURPLE_STATUS_UNAVAILABLE: chix_client_away_set(client, AWAY_BUSY); - printf("busy\n"); break; case PURPLE_STATUS_INVISIBLE: chix_client_away_set(client, AWAY_OFFLINE); - printf("invisible\n"); break; default: - printf("DEBUG: Unknown Chix status type\n"); break; } @@ -794,7 +782,6 @@ static void __info_update_cb(ChixClient *client, PurpleRequestFields *fields) { -#if 1 ChixInfo info; char buf[4]; @@ -819,13 +806,11 @@ info.options.forward = purple_request_fields_get_bool(fields, "forward"); chix_client_update_info(client, &info); -#endif } static void cp_action_info(PurplePluginAction *action) { -#if 1 PurpleRequestFields *fields; PurpleRequestFieldGroup *g; PurpleRequestField *f; @@ -835,10 +820,9 @@ char buf[64]; char buf2[64]; - pc = action->context; + pc = action->context; client = pc->proto_data; - info = client->info; - chix_info_print(info); + info = client->info; fields = purple_request_fields_new(); @@ -949,7 +933,6 @@ purple_request_fields(pc, _("Chix Info"), buf, buf2, fields, _("Update"), G_CALLBACK(__info_update_cb), _("Cancel"), NULL, NULL, NULL, NULL, pc->proto_data); -#endif } static GList * |