summaryrefslogtreecommitdiff
path: root/src/fe-text/irssi.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-12-03 05:23:26 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-12-03 05:23:26 +0000
commite70ca2164830301b6be49c7894d1a6a29e0a71f2 (patch)
treef42f9b980312ed4f6c12a958f402a29ab2d73074 /src/fe-text/irssi.c
parente720a50a8ac50fdaee880cad67db37e58ec3a5c7 (diff)
downloadirssi-e70ca2164830301b6be49c7894d1a6a29e0a71f2.zip
complain about old default.themes
notify new irssi users about startup-HOWTO git-svn-id: http://svn.irssi.org/repos/irssi/trunk@940 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-text/irssi.c')
-rw-r--r--src/fe-text/irssi.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/fe-text/irssi.c b/src/fe-text/irssi.c
index 4ae4f541..5172f2ac 100644
--- a/src/fe-text/irssi.c
+++ b/src/fe-text/irssi.c
@@ -150,8 +150,75 @@ static void textui_deinit(void)
core_deinit();
}
+static void irssi_firsttimer(void)
+{
+ char str[2];
+
+ printf("\nLooks like this is the first time you run irssi.\n");
+ printf("This is just a reminder that you really should go read\n");
+ printf("startup-HOWTO if you haven't already. Irssi's default\n");
+ printf("settings aren't probably what you've used to, and you\n");
+ printf("shouldn't judge the whole client as crap based on them.\n\n");
+ printf("You can find startup-HOWTO and more irssi beginner info at\n");
+ printf("http://irssi.org/beginner/\n");
+ fgets(str, sizeof(str), stdin);
+}
+
+static void check_oldcrap(void)
+{
+ FILE *f;
+ char *path, str[256];
+ int found;
+
+ /* check that default.theme is up-to-date */
+ path = g_strdup_printf("%s/.irssi/default.theme", g_get_home_dir());
+ f = fopen(path, "r+");
+ if (f == NULL) {
+ g_free(path);
+ return;
+ }
+ found = FALSE;
+ while (!found && fgets(str, sizeof(str), f) != NULL)
+ found = strstr(str, "abstracts = ") != NULL;
+ fclose(f);
+
+ if (found) {
+ g_free(path);
+ return;
+ }
+
+ printf("\nYou seem to have old default.theme in ~/.irssi/ directory.\n");
+ printf("Themeing system has changed a bit since last irssi release,\n");
+ printf("you should either delete your old default.theme or manually\n");
+ printf("merge it with the new default.theme.\n\n");
+ printf("Do you want to delete the old theme now? (Y/n)\n");
+
+ str[0] = '\0';
+ fgets(str, sizeof(str), stdin);
+ if (toupper(str[0]) == 'Y' || str[0] == '\n' || str[0] == '\0')
+ remove(path);
+ g_free(path);
+}
+
+static void check_files(void)
+{
+ struct stat statbuf;
+ char *path;
+
+ path = g_strdup_printf("%s/.irssi", g_get_home_dir());
+ if (stat(path, &statbuf) != 0) {
+ /* ~/.irssi doesn't exist, first time running irssi */
+ irssi_firsttimer();
+ } else {
+ check_oldcrap();
+ }
+ g_free(path);
+}
+
int main(int argc, char **argv)
{
+ check_files();
+
#ifdef HAVE_SOCKS
SOCKSinit(argv[0]);
#endif