changeset 180:0ff9f19b9b23

[gaim-migrate @ 190] Option to automatically check for new versions committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Wed, 26 Apr 2000 07:39:17 +0000
parents 8d8faeab01f6
children f2d631f867a3
files ChangeLog src/aim.c src/gaim.h src/gaimrc.c src/prefs.c src/util.c
diffstat 6 files changed, 56 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Apr 26 02:49:59 2000 +0000
+++ b/ChangeLog	Wed Apr 26 07:39:17 2000 +0000
@@ -3,6 +3,7 @@
 version 0.9.15:
 	* Plugin support enabled by default (oops)
 	* Some plugins built/installed by default
+	* Option to automagically check for new releases
 
 version 0.9.14:
 	* Numerous Fixes by G. Sumner Hayes (buffer over flow patches,
--- a/src/aim.c	Wed Apr 26 02:49:59 2000 +0000
+++ b/src/aim.c	Wed Apr 26 07:39:17 2000 +0000
@@ -447,6 +447,7 @@
 }
 
 extern show_debug(GtkObject *);
+
 int main(int argc, char *argv[])
 {
 #ifdef USE_APPLET
@@ -460,6 +461,12 @@
 
         set_defaults();
         load_prefs();
+
+	if (general_options & OPT_GEN_CHECK_VERSIONS)
+	{
+		check_gaim_versions();
+	}
+
 	if (general_options & OPT_GEN_DEBUG)
 		show_debug(NULL);
 
--- a/src/gaim.h	Wed Apr 26 02:49:59 2000 +0000
+++ b/src/gaim.h	Wed Apr 26 07:39:17 2000 +0000
@@ -296,7 +296,7 @@
 #define TYPE_SIGNOFF   4
 #define TYPE_KEEPALIVE 5
 
-#define REVISION "gaim:$Revision: 156 $"
+#define REVISION "gaim:$Revision: 190 $"
 #define FLAPON "FLAPON\r\n\r\n"
 
 #define ROAST "Tic/Toc"
@@ -364,7 +364,8 @@
 #define OPT_GEN_BROWSER_POPUP    0x00000800
 #define OPT_GEN_SAVED_WINDOWS    0x00001000
 #define OPT_GEN_DISCARD_WHEN_AWAY 0x00002000
-        
+#define OPT_GEN_CHECK_VERSIONS	0x00004000
+
 extern int display_options;
 #define OPT_DISP_SHOW_TIME       0x00000001
 #define OPT_DISP_SHOW_GRPNUM     0x00000002
@@ -404,6 +405,7 @@
 extern char login_host[512];
 extern int login_port;
 extern struct save_pos blist_pos;
+extern char latest_ver[25];
 
 /* Functions in about.c */
 extern void show_about(GtkWidget *, void *);
@@ -441,6 +443,7 @@
 extern char *sec_to_text(int);
 extern struct aim_user *find_user(const char *);
 extern char *full_date();
+extern void check_gaim_versions();
 
 /* Functions in server.c */
 /* input to serv */
--- a/src/gaimrc.c	Wed Apr 26 02:49:59 2000 +0000
+++ b/src/gaimrc.c	Wed Apr 26 07:39:17 2000 +0000
@@ -51,7 +51,7 @@
 int aim_port;
 char login_host[512];
 int login_port;
-
+char latest_ver[25];
 
 struct parse {
         char option[256];
@@ -446,6 +446,8 @@
                         sound_options = atoi(p->value[0]);
 		} else if (!strcmp(p->option, "font_options")) {
 			font_options = atoi(p->value[0]);
+		} else if (!strcmp(p->option, "latest_ver")) {
+			g_snprintf(latest_ver, BUF_LONG, "%s", p->value[0]);
                 } else if (!strcmp(p->option, "report_idle")) {
                         report_idle = atoi(p->value[0]);
                 } else if (!strcmp(p->option, "web_browser")) {
@@ -500,6 +502,7 @@
         fprintf(f, "\tblist_pos { %d } { %d } { %d } { %d } { %d } { %d }\n",
                 blist_pos.x, blist_pos.y, blist_pos.width, blist_pos.height,
                 blist_pos.xoff, blist_pos.yoff);
+	fprintf(f, "\tlatest_ver { %s }\n", latest_ver);
 	fprintf(f, "}\n");
 }
 
@@ -511,7 +514,8 @@
                 OPT_GEN_ENTER_SENDS |
                 OPT_GEN_SAVED_WINDOWS |
                 OPT_GEN_REMEMBER_PASS |
-		OPT_GEN_REGISTERED;
+		OPT_GEN_REGISTERED | 
+		OPT_GEN_CHECK_VERSIONS;
         display_options =
                 OPT_DISP_SHOW_IDLETIME |
                 OPT_DISP_SHOW_TIME |
@@ -536,6 +540,7 @@
         blist_pos.y = 0;
         blist_pos.xoff = 0;
         blist_pos.yoff = 0;
+	g_snprintf(latest_ver, BUF_LONG, "%s", VERSION);
 }
 
 
--- a/src/prefs.c	Wed Apr 26 02:49:59 2000 +0000
+++ b/src/prefs.c	Wed Apr 26 07:39:17 2000 +0000
@@ -384,6 +384,7 @@
 	gaim_button("Show Lag-O-Meter", &general_options, OPT_GEN_SHOW_LAGMETER, genbox);
         gaim_button("Save some window size/positions", &general_options, OPT_GEN_SAVED_WINDOWS, genbox);
         gaim_button("Ignore new conversations when away", &general_options, OPT_GEN_DISCARD_WHEN_AWAY, genbox);
+	gaim_button("Automagically check for new releases", &general_options, OPT_GEN_CHECK_VERSIONS, genbox);
 	if (!dw && (general_options & OPT_GEN_DEBUG))
 		general_options = general_options ^ OPT_GEN_DEBUG;
         debugbutton = gaim_button("Enable debug mode", &general_options, OPT_GEN_DEBUG, genbox);
--- a/src/util.c	Wed Apr 26 02:49:59 2000 +0000
+++ b/src/util.c	Wed Apr 26 07:39:17 2000 +0000
@@ -710,3 +710,38 @@
         g_free(who);
         return NULL;
 }
+
+void check_gaim_versions()
+{
+	char *cur_ver;
+	char *tmp;
+
+	cur_ver = (char *)malloc(BUF_LONG);
+	tmp = (char *)malloc(BUF_LONG);
+
+	cur_ver = (char *)grab_url("http://www.marko.net/gaim/latest-gaim");
+
+	if (!strncasecmp(cur_ver, "g00", 3))
+	{
+		free(cur_ver);
+		free(tmp);
+		return;
+	}
+
+	g_snprintf(tmp, BUF_LONG, "%s", strstr(cur_ver, "plain")+9);
+	g_strchomp(tmp);
+
+	if (strcasecmp(tmp, latest_ver))
+	{
+		g_snprintf(cur_ver, BUF_LONG, "GAIM v%s is now available.\n\nDownload it at http://www.marko.net/gaim\n", tmp);
+	
+		do_error_dialog(cur_ver, "GAIM - New Version!");
+		strcpy(latest_ver, tmp);
+		save_prefs();
+	}
+
+	free(tmp);
+	free(cur_ver);
+}
+
+