|
From: xevuz <xe...@us...> - 2007-07-15 10:04:23
|
Update of /cvsroot/chix/chix_gaim/src In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv27218/src Modified Files: chix_gaim.c Log Message: fix status once and for all. (i hope) Index: chix_gaim.c =================================================================== RCS file: /cvsroot/chix/chix_gaim/src/chix_gaim.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- chix_gaim.c 14 Jul 2007 02:53:25 -0000 1.19 +++ chix_gaim.c 15 Jul 2007 10:04:19 -0000 1.20 @@ -62,9 +62,9 @@ { char buf[16]; - if (chix_buddy_away_get(buddy, buf, sizeof(buf)) == AWAY_AWAY) + if (chix_buddy_away_get(buddy, NULL, 0) == AWAY_AWAY) purple_prpl_got_user_status(account, buddy->id, "away", NULL); - else if (chix_buddy_away_get(buddy, buf, sizeof(buf)) == AWAY_BUSY) + else if (chix_buddy_away_get(buddy, NULL, 0) == AWAY_BUSY) purple_prpl_got_user_status(account, buddy->id, "busy", NULL); else if (CHIX_BUDDY_ON_PC(buddy)) purple_prpl_got_user_status(account, buddy->id, "available", NULL); @@ -403,6 +403,8 @@ char buf2[16]; chix_buddy_away_get(buddy, buf2, sizeof(buf2)); + printf("%s\n", __func__); + printf("%s\n", buf2); if (CHIX_BUDDY_ON_BOTH(buddy)) g_snprintf(buf, size, _("%s %s"), buf2, _("(PC/Mobile)")); @@ -419,9 +421,12 @@ { char buf[64]; + printf("%s\n", __func__); + if (!buddy->proto_data) return g_strdup(_("Buddy not listed")); __status_text(buddy->proto_data, buf, sizeof(buf)); + printf("%s\n", buf); return g_strdup(buf); } @@ -639,24 +644,6 @@ break; } -/* - else if (!strcmp(state, _("Not in the mood"))) - chix_client_mood_set(client, MOOD_NONE); - else if (!strcmp(state, _("Happy"))) - chix_client_mood_set(client, MOOD_HAPPY); - else if (!strcmp(state, _("Sad"))) - chix_client_mood_set(client, MOOD_SAD); - else if (!strcmp(state, _("Secretive"))) - chix_client_mood_set(client, MOOD_SECRETIVE); - else if (!strcmp(state, _("Playful"))) - chix_client_mood_set(client, MOOD_PLAYFUL); - else if (!strcmp(state, _("Surprised"))) - chix_client_mood_set(client, MOOD_SURPRISED); - else if (!strcmp(state, _("Intimate"))) - chix_client_mood_set(client, MOOD_INTIMATE); - else if (!strcmp(state, _("Angry"))) - chix_client_mood_set(client, MOOD_ANGRY); -*/ } static void @@ -894,7 +881,7 @@ purple_request_field_group_add_field(g, f); f = purple_request_field_string_new( - "state", _("State"), info->state, FALSE); + "mood", _("State"), info->state, FALSE); purple_request_field_group_add_field(g, f); f = purple_request_field_string_new( @@ -935,6 +922,47 @@ _("Cancel"), NULL, NULL, NULL, NULL, pc->proto_data); } +static void +__mood_update_cb(ChixClient *client, PurpleRequestFields *fields) +{ + chix_client_mood_set(client, purple_request_fields_get_choice(fields, "mood")); +} + +static void +cp_action_mood(PurplePluginAction *action) +{ + PurpleRequestFields *fields; + PurpleRequestFieldGroup *group; + PurpleRequestField *field; + PurpleConn *pc; + ChixClient *cl; + + pc = action->context; + cl = pc->proto_data; + + fields = purple_request_fields_new(); + group = purple_request_field_group_new(_("Mood")); + field = purple_request_field_choice_new("mood", _(""), + chix_clientcl->info->mood); + + purple_request_field_choice_add(field, _("Not in the mood")); + purple_request_field_choice_add(field, _("Happy")); + purple_request_field_choice_add(field, _("Sad")); + purple_request_field_choice_add(field, _("Secretive")); + purple_request_field_choice_add(field, _("Playful")); + purple_request_field_choice_add(field, _("Surprised")); + purple_request_field_choice_add(field, _("Intimate")); + purple_request_field_choice_add(field, _("Angry")); + + purple_request_field_set_required(field, TRUE); + purple_request_field_group_add_field(group, field); + purple_request_fields_add_group(fields, group); + + purple_request_fields(pc, _("Chix Info"), buf, buf2, fields, + _("Update"), G_CALLBACK(__mood_update_cb), + _("Cancel"), NULL, NULL, NULL, NULL, pc->proto_data); +} + static GList * cp_actions(PurplePlugin *plugin, gpointer context) { |