# HG changeset patch # User Rob Flynn # Date 966136506 0 # Node ID ddc3fd0dcd51a813f9ae22b21ecec65e0bbda494 # Parent 84987d2e4bd4a708fc990a7a651b61ba81742236 [gaim-migrate @ 683] Made the necessary modifications to allow gaim to save buddy pounces. I just noticed that you cant _delete_ (remove) a buddy pounce. Woops. I'll take a look at that. I'll do saving of buddy chats when I get back from dinner. Adios. committer: Tailor Script diff -r 84987d2e4bd4 -r ddc3fd0dcd51 ChangeLog --- a/ChangeLog Sun Aug 13 02:06:09 2000 +0000 +++ b/ChangeLog Sun Aug 13 03:15:06 2000 +0000 @@ -14,6 +14,7 @@ * Redesigned conversation dialog * Removed the Lag-O-Meter * Socks 4/5 Proxy works + * Buddy Pounces are now saved in .gaimrc version 0.9.20 (07/14/2000): * More plugin events, more plugin features diff -r 84987d2e4bd4 -r ddc3fd0dcd51 TODO --- a/TODO Sun Aug 13 02:06:09 2000 +0000 +++ b/TODO Sun Aug 13 03:15:06 2000 +0000 @@ -2,7 +2,6 @@ Ability to merge gaim, toc, aim2, aim4 buddylists Third sound option for people without soundcards who still want sound events. Make a PC Speaker Beep (^G / Char 7) - Save Buddy Pounces Save Buddy Chats Execute Command on Buddy Pounce Hmm, fix hehe. Doesnt seem to want to @@ -14,3 +13,4 @@ on your buddy list. This won't be too hard it'll just take a bit of work. Maybe we'll save this one for the release after our next release. + Fix deletion of buddy pounces diff -r 84987d2e4bd4 -r ddc3fd0dcd51 src/gaimrc.c --- a/src/gaimrc.c Sun Aug 13 02:06:09 2000 +0000 +++ b/src/gaimrc.c Sun Aug 13 03:15:06 2000 +0000 @@ -146,6 +146,8 @@ return 2; } else if (!strcmp(tag, "plugins")) { return 3; + } else if (!strcmp(tag, "pounce")) { + return 4; } return -1; @@ -240,6 +242,72 @@ fprintf(f, "}\n"); } +static void gaimrc_read_pounce(FILE *f) +{ + struct parse *p; + char buf[4096]; + struct buddy_pounce *b; + + buf[0] = 0; + + while (buf[0] != '}') + { + if (!fgets(buf, sizeof(buf), f)) + return; + + if (buf[0] == '}') + return; + + p = parse_line(buf); + if (!strcmp(p->option, "entry")) + { + b = g_new0(struct buddy_pounce, 1); + + g_snprintf(b->name, sizeof(b->name), "%s", p->value[0]); + g_snprintf(b->message, sizeof(b->message), "%s", p->value[1]); + + b->popup = atoi(p->value[2]); + b->sendim = atoi(p->value[3]); + + filter_break(b->message); + buddy_pounces = g_list_append(buddy_pounces, b); + } + } +} + +static void gaimrc_write_pounce(FILE *f) +{ + GList *pnc = buddy_pounces; + struct buddy_pounce *b; + + fprintf(f, "pounce {\n"); + + if (pnc) + { + while (pnc) { + char *str1, *str2; + int popup, sendim; + + b = (struct buddy_pounce *)pnc->data; + + str1 = escape_text2(b->name); + str2 = escape_text2(b->message); + popup = b->popup; + sendim = b->sendim; + + fprintf(f, "\tentry { %s } { %s } { %d } { %d }\n", str1, str2, popup, sendim); + + /* escape_text2 uses malloc(), so we don't want to g_free these */ + free(str1); + free(str2); + + pnc = pnc->next; + } + } + + fprintf(f, "}\n"); +} + #ifdef GAIM_PLUGINS static void gaimrc_write_plugins(FILE *f) { @@ -607,6 +675,9 @@ gaimrc_read_plugins(f); break; #endif + case 4: + gaimrc_read_pounce(f); + break; default: /* NOOP */ break; @@ -628,15 +699,15 @@ if ((f = fopen(buf,"w"))) { fprintf(f, "# .gaimrc v%d\n", 2); gaimrc_write_users(f); - gaimrc_write_options(f); - gaimrc_write_away(f); + gaimrc_write_options(f); + gaimrc_write_away(f); #ifdef GAIM_PLUGINS gaimrc_write_plugins(f); #endif - fclose(f); - chmod(buf, S_IRUSR | S_IWUSR); - } - + gaimrc_write_pounce(f); + fclose(f); + chmod(buf, S_IRUSR | S_IWUSR); + } } } diff -r 84987d2e4bd4 -r ddc3fd0dcd51 src/prefs.c --- a/src/prefs.c Sun Aug 13 02:06:09 2000 +0000 +++ b/src/prefs.c Sun Aug 13 03:15:06 2000 +0000 @@ -1121,7 +1121,7 @@ aol_icon(prefs->window); gtk_container_border_width(GTK_CONTAINER(prefs), 10); gtk_window_set_title(GTK_WINDOW(prefs), _("Gaim - Preferences")); - gtk_widget_set_usize(prefs, 600, 400); + gtk_widget_set_usize(prefs, 600, 440); vbox = gtk_vbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(prefs), vbox);