+++ /dev/null
-diff -ur gg-0.2.2.1.orig/src/main.c gg-0.2.2.1/src/main.c
---- gg-0.2.2.1.orig/src/main.c Mon Apr 22 11:59:01 2002
-+++ gg-0.2.2.1/src/main.c Thu Jun 13 12:20:39 2002
-@@ -286,7 +286,16 @@
- config.uin = atoi(line + 4);
- }
- if (g_strncasecmp(line, "password ", 9) == 0) {
-+ char *tmp;
-+
- config.password = g_strdup(g_strstrip(line + 9));
-+
-+ if (*config.password == 1) {
-+ tmp = config.password;
-+ config.password++;
-+ config.password = base64_decode(config.password);
-+ free(tmp);
-+ }
- }
- if (g_strncasecmp(line, "email ", 6) == 0) {
- config.email = g_strdup(g_strstrip(line + 6));
-@@ -427,6 +436,7 @@
- FILE *fp;
- gchar *path;
- GList *tmp_ignore;
-+ gchar *tmp;
- if (window != NULL) {
- config.width=window->allocation.width;
- config.height=window->allocation.height;
-@@ -444,7 +454,13 @@
- chmod(path, S_IRUSR | S_IWUSR);
-
- fprintf(fp, "uin %d\n", config.uin);
-- fprintf(fp, "password %s\n", config.password);
-+
-+ if (config.password != NULL) {
-+ tmp = base64_encode(config.password);
-+ fprintf(fp, "password \1%s\n", tmp);
-+ free(tmp);
-+ }
-+
- if (config.email != NULL)
- fprintf(fp, "email %s\n", config.email);
- fprintf(fp, "auto_away %d\n", config.auto_away);
-diff -ur gg-0.2.2.1.orig/src/support.c gg-0.2.2.1/src/support.c
---- gg-0.2.2.1.orig/src/support.c Wed Mar 27 11:35:57 2002
-+++ gg-0.2.2.1/src/support.c Thu Jun 13 12:19:31 2002
-@@ -505,3 +505,105 @@
- return buf;
- }
-
-+/*
-+ *
-+ * base64_*() - autorstwa brygady RR czyli EKG team'u ;-)
-+ *
-+ */
-+
-+static char base64_charset[] =
-+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-+
-+/*
-+ * base64_encode()
-+ *
-+ * zapisuje ci±g znaków w base64. alokuje pamiêæ.
-+ */
-+char *base64_encode(char *buf)
-+{
-+ char *out, *res;
-+ int i = 0, j = 0, k = 0, len = strlen(buf);
-+
-+ if (!(res = out = malloc((len / 3 + 1) * 4 + 2))) {
-+ g_print("// base64_encode() not enough memory\n");
-+ return NULL;
-+ }
-+
-+ while (j <= len) {
-+ switch (i % 4) {
-+ case 0:
-+ k = (buf[j] & 252) >> 2;
-+ break;
-+ case 1:
-+ k = ((buf[j] & 3) << 4) | ((buf[++j] & 240) >> 4);
-+ break;
-+ case 2:
-+ k = ((buf[j] & 15) << 2) | ((buf[++j] & 192) >> 6);
-+ break;
-+ case 3:
-+ k = buf[j++] & 63;
-+ break;
-+ }
-+ *out++ = base64_charset[k];
-+ i++;
-+ }
-+
-+ if (i % 4)
-+ for (j = 0; j < 4 - (i % 4); j++, out++)
-+ *out = '=';
-+
-+ *out = 0;
-+
-+ return res;
-+}
-+
-+/*
-+ * base64_decode()
-+ *
-+ * wczytuje ci±g znaków base64, zwraca zaalokowany buforek.
-+ */
-+char *base64_decode(char *buf)
-+{
-+ char *res, *save, *end, *foo, val;
-+ int index = 0;
-+
-+ if (!(save = res = calloc(1, (strlen(buf) / 4 + 1) * 3 + 2))) {
-+ g_print("// base64_decode() not enough memory\n");
-+ return NULL;
-+ }
-+
-+ end = buf + strlen(buf);
-+
-+ while (*buf && buf < end) {
-+ if (*buf == '\r' || *buf == '\n') {
-+ buf++;
-+ continue;
-+ }
-+ if (!(foo = strchr(base64_charset, *buf)))
-+ foo = base64_charset;
-+ val = (int)foo - (int)base64_charset;
-+ *buf = 0;
-+ buf++;
-+ switch (index) {
-+ case 0:
-+ *res |= val << 2;
-+ break;
-+ case 1:
-+ *res++ |= val >> 4;
-+ *res |= val << 4;
-+ break;
-+ case 2:
-+ *res++ |= val >> 2;
-+ *res |= val << 6;
-+ break;
-+ case 3:
-+ *res++ |= val;
-+ break;
-+ }
-+ index++;
-+ index %= 4;
-+ }
-+ *res = 0;
-+
-+ return save;
-+}
-diff -ur gg-0.2.2.1.orig/src/support.h gg-0.2.2.1/src/support.h
---- gg-0.2.2.1.orig/src/support.h Mon Jan 28 15:42:44 2002
-+++ gg-0.2.2.1/src/support.h Thu Jun 13 12:19:15 2002
-@@ -85,3 +85,5 @@
-
- gchar *gg_urlencode(gchar * str);
-
-+char *base64_decode(char *);
-+char *base64_encode(char *);
+++ /dev/null
-diff -Nur gg-0.2.2.1.orig/src/callbacks.c gg-0.2.2.1/src/callbacks.c
---- gg-0.2.2.1.orig/src/callbacks.c Wed May 1 10:07:08 2002
-+++ gg-0.2.2.1/src/callbacks.c Wed May 29 13:43:33 2002
-@@ -408,7 +408,7 @@
- gchar *path;
-
- path =
-- g_strdup_printf("%s/.gg/history/%d", getenv("HOME"),
-+ g_strdup_printf("%s/history/%d", config.homedir,
- kontakt->uin);
- fp = fopen(path, "r");
- if (fp) {
-diff -Nur gg-0.2.2.1.orig/src/gg-types.h gg-0.2.2.1/src/gg-types.h
---- gg-0.2.2.1.orig/src/gg-types.h Mon Apr 22 11:59:01 2002
-+++ gg-0.2.2.1/src/gg-types.h Wed May 29 13:34:54 2002
-@@ -61,6 +61,7 @@
- guint save_config_on_exit;
- guint save_contacts_on_exit;
- gchar *server;
-+ gchar *homedir;
- } GGConfig;
-
- typedef struct {
-diff -Nur gg-0.2.2.1.orig/src/gg.c gg-0.2.2.1/src/gg.c
---- gg-0.2.2.1.orig/src/gg.c Fri Apr 19 16:04:50 2002
-+++ gg-0.2.2.1/src/gg.c Wed May 29 13:43:09 2002
-@@ -407,12 +407,12 @@
- gchar *path, *timestamp, *lognick;
- FILE *fp;
-
-- path = g_strdup_printf("%s/.gg/history", getenv("HOME"));
-+ path = g_strdup_printf("%s/history", config.homedir);
- mkdir(path, 0755);
- g_free(path);
-
- path =
-- g_strdup_printf("%s/.gg/history/%d", getenv("HOME"), sess_uin);
-+ g_strdup_printf("%s/history/%d", config.homedir, sess_uin);
- fp = fopen(path, "a");
- g_free(path);
-
-diff -Nur gg-0.2.2.1.orig/src/main.c gg-0.2.2.1/src/main.c
---- gg-0.2.2.1.orig/src/main.c Mon Apr 22 11:59:01 2002
-+++ gg-0.2.2.1/src/main.c Wed May 29 13:39:50 2002
-@@ -80,7 +80,7 @@
- FILE *fp;
- GList *tmplist;
-
-- path = g_strconcat(g_get_home_dir(), "/.gg/userlist", NULL);
-+ path = g_strconcat(config.homedir, "/userlist", NULL);
-
- fp = fopen(path, "w");
-
-@@ -139,7 +139,7 @@
- }
- gtk_clist_clear(GTK_CLIST(lista));
-
-- path = g_strconcat(getenv("HOME"), "/.gg/userlist", NULL);
-+ path = g_strconcat(config.homedir, "/userlist", NULL);
-
- fp = fopen(path, "r");
-
-@@ -271,7 +271,7 @@
- config.save_contacts_on_exit = 1;
- config.server = g_strdup(GG_DEFAULT_HOST);
-
-- path = g_strconcat(getenv("HOME"), "/.gg/config", NULL);
-+ path = g_strconcat(config.homedir, "/config", NULL);
-
- g_list_free(ignore);
-
-@@ -431,7 +431,7 @@
- config.width=window->allocation.width;
- config.height=window->allocation.height;
- }
-- path = g_strconcat(getenv("HOME"), "/.gg/config", NULL);
-+ path = g_strconcat(config.homedir, "/config", NULL);
-
- fp = fopen(path, "w");
-
-@@ -572,12 +572,16 @@
- #ifdef USE_APPLET
- gchar applet_name[] = "gg";
- #endif
-- gchar *path = NULL;
-
-- path = g_strconcat(getenv("HOME"), "/.gg", NULL);
-- mkdir(path, 0755);
-- g_free(path);
-+ config.homedir = NULL;
-+ if (getenv("CONFIG_DIR"))
-+ config.homedir = g_strconcat(getenv("HOME"),"/",
-+ getenv("CONFIG_DIR"), "/gg", NULL);
-+ else
-+ config.homedir = g_strconcat(getenv("HOME"), "/.gg", NULL);
-
-+ mkdir(config.homedir, 0700);
-+
- read_config();
-
- g_set_print_handler((GPrintFunc) my_g_print);
-@@ -649,5 +653,7 @@
- gtk_main();
- #endif
-
-+ g_free(config.homedir);
-+
- return 0;
- }