diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | FIXME | 4 | ||||
-rw-r--r-- | HACKING | 3 | ||||
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | doc/CREDITS | 4 | ||||
-rw-r--r-- | src/dialogs.c | 59 | ||||
-rw-r--r-- | src/gaim.h | 4 | ||||
-rw-r--r-- | src/server.c | 53 | ||||
-rw-r--r-- | src/util.c | 126 |
9 files changed, 192 insertions, 63 deletions
@@ -15,6 +15,7 @@ version 0.10.0: * Removed the Lag-O-Meter * Socks 4/5 Proxy works * Buddy Pounces are now saved in .gaimrc + # Ability to merge gaim, aim2, aim4 buddylists. Thanks again bmiller! version 0.9.20 (07/14/2000): * More plugin events, more plugin features @@ -1,3 +1,5 @@ GAIM: Items to be fixed ------------------------ - +For the Permit/Deny Stuff, everything is working, except for "Deny people in 'Deny'", +which sucks for people like me who have 16 people in their deny list. The Oscar side +of things is broken beyond repair too. @@ -13,6 +13,9 @@ on in the preferences) whether or not --enable-debug was selected. Most of the information that's printed is useless anyway though; so the --enable-debug option really doesn't do a whole lot. +This was written around August 8, 2000. It's now August 15, 2000, and I'm +sure a lot of it is already out of date. + PROGRAM FLOW ============ @@ -1,5 +1,4 @@ --- STUFF FOR 0.10.1 RELEASE --- - 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 Chats diff --git a/doc/CREDITS b/doc/CREDITS index 897501f7d6..c2c9e3a6ff 100644 --- a/doc/CREDITS +++ b/doc/CREDITS @@ -36,6 +36,10 @@ Decklin Foster Info box looks nicer David <IM: CrazyDavy> The neato-bigger text box +S D Erle + Writing a cool perl script to translate WinAIM lists to gaim +BMiller + Translating perl code to C so gaim can import lists itself G. Sumner Hayes <IM: SumnerFool> Security Patches Brian Ryner for a little make file patch :) diff --git a/src/dialogs.c b/src/dialogs.c index adab2a2b01..75cabd2a7f 100644 --- a/src/dialogs.c +++ b/src/dialogs.c @@ -2705,7 +2705,38 @@ void do_import(GtkWidget *w, void *dummy) fgets(first, 64, f); + /* AIM 4 buddy list */ if (!strcasecmp(first, "Config {\n")) { + debug_print("aim 4\n"); + rewind(f); + translate_blt (f, buf); + sprintf(debug_buff, "%s\n", buf); + debug_print(debug_buff); + buf2 = buf; + buf = g_malloc(8193); + g_snprintf(buf, 8192, "toc_set_config {%s}\n", buf2); + g_free(buf2); + /* AIM 3 buddy list */ + } else if (strstr(first, "group") != NULL) { + debug_print("aim 3\n"); + rewind(f); + translate_lst (f, buf); + sprintf(debug_buff, "%s\n", buf); + debug_print(debug_buff); + buf2 = buf; + buf = g_malloc(8193); + g_snprintf(buf, 8192, "toc_set_config {%s}\n", buf2); + g_free(buf2); + /* GAIM buddy list - no translation */ + } else if (first[0] == 'm') { + rewind(f); + fread(buf, BUF_LONG, 1, f); + buf2 = buf; + buf = g_malloc(8193); + g_snprintf(buf, 8192, "toc_set_config {%s}\n", buf2); + g_free(buf2); + /* Something else */ + } else { if ( show_dialog == 1 ) { destroy_dialog(NULL, importdialog); importdialog = NULL; @@ -2714,35 +2745,15 @@ void do_import(GtkWidget *w, void *dummy) g_free(first); fclose( f ); return; - } else if (buf[0] == 'm') { - buf2 = buf; - buf = g_malloc(8193); - g_snprintf(buf, 8192, "toc_set_config {%s}\n", buf2); - g_free(buf2); - } - - - fseek(f, 0, SEEK_SET); - - fread(buf, BUF_LONG, 1, f); + } - grp = groups; - - /* why is this being done? if we merge them than this shouldn't happen - while(grp) { - grp2 = grp->next; - remove_group((struct group *)grp->data); - grp = grp2; - } - */ - parse_toc_buddy_list(buf, 1); serv_save_config(); - + build_edit_tree(); build_permit_tree(); - + fclose( f ); if ( show_dialog == 1 ) { @@ -2752,7 +2763,7 @@ void do_import(GtkWidget *w, void *dummy) destroy_dialog(NULL, importdialog); importdialog = NULL; } - + g_free(buf); g_free(first); } diff --git a/src/gaim.h b/src/gaim.h index 0527e0c78e..7b0f5f37ad 100644 --- a/src/gaim.h +++ b/src/gaim.h @@ -393,7 +393,7 @@ struct signon { #define TYPE_SIGNOFF 4 #define TYPE_KEEPALIVE 5 -#define REVISION "gaim:$Revision: 688 $" +#define REVISION "gaim:$Revision: 694 $" #define FLAPON "FLAPON\r\n\r\n" #define ROAST "Tic/Toc" @@ -570,6 +570,8 @@ extern void spell_checker(GtkWidget *); extern char *away_subs(char *, char *); extern GtkWidget *picture_button(GtkWidget *, char *, char **); extern GtkWidget *picture_button2(GtkWidget *, char *, char **); +extern void translate_lst (FILE *, char *); +extern void translate_blt (FILE *, char *); /* Functions in server.c */ /* input to serv */ diff --git a/src/server.c b/src/server.c index 6a0b4cfe8f..a2ad1be73a 100644 --- a/src/server.c +++ b/src/server.c @@ -384,54 +384,33 @@ void serv_set_permit_deny() switch (permdeny) { case PERMIT_ALL: - /* toc_add_permit current_user to go to permit mode, - toc_add_deny <none> to deny none */ sprintf(buf, "toc_add_deny %s", current_user->username); sflap_send(buf, -1, TYPE_DATA); break; case PERMIT_NONE: - /* toc_add_deny current_user to go to deny mode, - toc_add_permit <none> to permit none */ sprintf(buf, "toc_add_permit %s", current_user->username); sflap_send(buf, -1, TYPE_DATA); break; case PERMIT_SOME: - /* toc_add_permit <permit> */ - /* if permit is empty this is the same as PERMIT_NONE */ - if (permit) { - at = g_snprintf(buf, sizeof(buf), "toc_add_permit"); - list = permit; - while (list) { - at += g_snprintf(&buf[at], sizeof(buf) - at, " %s", normalize(list->data)); - list = list->next; - } - buf[at] = 0; /* is this necessary? */ - sflap_send(buf, -1, TYPE_DATA); - } else { - sprintf(buf, "toc_add_deny %s", current_user->username); - sflap_send(buf, -1, TYPE_DATA); - sprintf(buf, "toc_add_permit"); - sflap_send(buf, -1, TYPE_DATA); + at = g_snprintf(buf, sizeof(buf), "toc_add_permit"); + list = permit; + while (list) { + at += g_snprintf(&buf[at], sizeof(buf) - at, " %s", normalize(list->data)); + list = list->next; } + buf[at] = 0; /* is this necessary? */ + sflap_send(buf, -1, TYPE_DATA); break; case DENY_SOME: - /* toc_add_deny <deny> */ - /* if deny is empty this is the same as PERMIT_ALL */ - if (deny) { - at = g_snprintf(buf, sizeof(buf), "toc_add_deny"); - list = deny; - while (list) { - at += g_snprintf(&buf[at], sizeof(buf) - at, " %s", normalize(list->data)); - list = list->next; - } - buf[at] = 0; /* is this necessary? */ - sflap_send(buf, -1, TYPE_DATA); - } else { - sprintf(buf, "toc_add_permit %s", current_user->username); - sflap_send(buf, -1, TYPE_DATA); - sprintf(buf, "toc_add_deny"); - sflap_send(buf, -1, TYPE_DATA); + /* FIXME! This still doesn't work */ + at = g_snprintf(buf, sizeof(buf), "toc_add_deny"); + list = deny; + while (list) { + at += g_snprintf(&buf[at], sizeof(buf) - at, " %s", normalize(list->data)); + list = list->next; } + buf[at] = 0; /* is this necessary? */ + sflap_send(buf, -1, TYPE_DATA); break; } } else { @@ -476,6 +455,8 @@ void serv_set_permit_deny() if (list) at += g_snprintf(&buf[at], sizeof(buf) - at, "&"); } + sprintf(debug_buff, "denying %s\n", buf); + debug_print(debug_buff); aim_bos_changevisibility(gaim_sess, gaim_conn, AIM_VISIBILITYCHANGE_DENYADD, buf); } else { diff --git a/src/util.c b/src/util.c index 080454adf0..e2df1c1f54 100644 --- a/src/util.c +++ b/src/util.c @@ -971,3 +971,129 @@ GtkWidget *picture_button2(GtkWidget *window, char *text, char **xpm) return button; } + +/* remove leading whitespace from a string */ +char *remove_spaces (char *str) +{ + int i; + char *new; + + if (str == NULL) + return NULL; + + i = strspn (str, " \t\n\r\f"); + new = &str[i]; + + return new; +} + + +/* translate an AIM 3 buddylist (*.lst) to a GAIM buddylist */ +void translate_lst (FILE *src_fp, char *dest) +{ + char line[BUF_LEN], *line2; + char *name; + int i; + + sprintf (dest, "m 1\n"); + + while (fgets (line, BUF_LEN, src_fp)) { + line2 = remove_spaces (line); + if (strstr (line2, "group") == line2) { + name = strpbrk (line2, " \t\n\r\f") + 1; + strcat (dest, "g "); + for (i = 0; i < strcspn (name, "\n\r"); i++) + if (name[i] != '\"') + strncat (dest, &name[i], 1); + strcat (dest, "\n"); + } + if (strstr (line2, "buddy") == line2) { + name = strpbrk (line2, " \t\n\r\f") + 1; + strcat (dest, "b "); + for (i = 0; i < strcspn (name, "\n\r"); i++) + if (name[i] != '\"') + strncat (dest, &name[i], 1); + strcat (dest, "\n"); + } + } + + return; +} + + +/* translate an AIM 4 buddylist (*.blt) to GAIM format */ +void translate_blt (FILE *src_fp, char *dest) +{ + int i; + char line[BUF_LEN]; + char *buddy; + + sprintf (dest, "m 1\n"); + + while (strstr (fgets (line, BUF_LEN, src_fp), "Buddy") == NULL) ; + while (strstr (fgets (line, BUF_LEN, src_fp), "list") == NULL) ; + + while (1) { + fgets (line, BUF_LEN, src_fp); + if (strchr (line, '}') != NULL) + break; + + /* Syntax starting with "<group> {" */ + if (strchr (line, '{') != NULL) { + strcat (dest, "g "); + buddy = remove_spaces (strtok (line, "{")); + for (i = 0; i < strlen(buddy); i++) { + if (buddy[i] != '\"') + strncat (dest, &buddy[i], 1); + } + strcat (dest, "\n"); + while (strchr (fgets (line, BUF_LEN, src_fp), '}') == NULL) { + buddy = remove_spaces (line); + strcat (dest, "b "); + if (strchr (buddy, '\"') != NULL) { + strncat (dest, &buddy[1], strlen(buddy)-3); + strcat (dest, "\n"); + } else + strcat (dest, buddy); + } + } + /* Syntax "group buddy buddy ..." */ + else { + buddy = remove_spaces (strtok (line, " \n")); + strcat (dest, "g "); + if (strchr (buddy, '\"') != NULL) { + strcat (dest, &buddy[1]); + strcat (dest, " "); + buddy = remove_spaces (strtok (NULL, " \n")); + while (strchr (buddy, '\"') == NULL) { + strcat (dest, buddy); + strcat (dest, " "); + buddy = remove_spaces (strtok (NULL, " \n")); + } + strncat (dest, buddy, strlen(buddy)-1); + } else { + strcat (dest, buddy); + } + strcat (dest, "\n"); + while ((buddy = remove_spaces (strtok (NULL, " \n"))) != NULL) { + strcat (dest, "b "); + if (strchr (buddy, '\"') != NULL) { + strcat (dest, &buddy[1]); + strcat (dest, " "); + buddy = remove_spaces (strtok (NULL, " \n")); + while (strchr (buddy, '\"') == NULL) { + strcat (dest, buddy); + strcat (dest, " "); + buddy = remove_spaces (strtok (NULL, " \n")); + } + strncat (dest, buddy, strlen(buddy)-1); + } else { + strcat (dest, buddy); + } + strcat (dest, "\n"); + } + } + } + + return; +} |