Mercurial > pidgin.yaz
diff src/util.c @ 2382:569ae9f2bb89
[gaim-migrate @ 2395]
big reorg of code. list.c contains 0 gtk.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Fri, 28 Sep 2001 07:46:36 +0000 |
parents | cacaf7ace3a5 |
children | 520257562955 |
line wrap: on
line diff
--- a/src/util.c Fri Sep 28 05:17:16 2001 +0000 +++ b/src/util.c Fri Sep 28 07:46:36 2001 +0000 @@ -716,135 +716,6 @@ return (cpy); } - - -/* 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) { - buddy++; - strncat(dest, buddy, strchr(buddy, '\"') - buddy); - 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; -} - char *stylize(gchar *text, int length) { gchar *buf;