[ekg-commit] ekg: commands.c (HEAD) configfile.c (HEAD) events.c (HEAD) log.c (HEAD) msgqueue.c (HEAD) stuff.c (HEAD) stuff.h (HEAD) userlist.c (HEAD) vars.c (HEAD) [gophi]

EKG commit list ekg-commit at lists.ziew.org
Sat Jul 7 17:46:00 CEST 2007


Module name:	ekg
Changes by:	gophi	2007-07-07 17:45:57

Modified files:
	commands.c configfile.c events.c log.c msgqueue.c stuff.c stuff.h
	userlist.c vars.c

Log message:
- dodanie zmiennych files_mode_config, files_mode_received (Socek/g)

Index: commands.c
===================================================================
RCS file: /home/cvs/ekg/src/commands.c,v
diff -d -u -r1.777 -r1.778
--- commands.c	5 Jul 2007 04:12:13 -0000	1.777
+++ commands.c	7 Jul 2007 15:45:55 -0000	1.778
@@ -3405,7 +3405,7 @@
 			fd = open((char *) path, O_WRONLY);
 			offset = lseek(fd, 0, SEEK_END);
 		} else {
-			fd = open((char *) path, O_WRONLY | O_CREAT, 0600);
+			fd = open((char *) path, O_WRONLY | O_CREAT, config_files_mode_received);
 			offset = 0;
 		}
 

Index: configfile.c
===================================================================
RCS file: /home/cvs/ekg/src/configfile.c,v
diff -d -u -r1.20 -r1.21
--- configfile.c	24 Jan 2007 02:44:07 -0000	1.20
+++ configfile.c	7 Jul 2007 15:45:56 -0000	1.21
@@ -513,7 +513,7 @@
 	if (!(f = fopen(tmp, "w")))
 		return -1;
 	
-	fchmod(fileno(f), 0600);
+	fchmod(fileno(f), config_files_mode_config);
 
 	config_write_main(f, 1);
 
@@ -563,7 +563,7 @@
 	
 	wrote = xcalloc(array_count(vars) + 1, sizeof(int));
 	
-	fchmod(fileno(fo), 0600);
+	fchmod(fileno(fo), config_files_mode_config);
 
 	while ((line = read_file(fi))) {
 		char *tmp;

Index: events.c
===================================================================
RCS file: /home/cvs/ekg/src/events.c,v
diff -d -u -r1.386 -r1.387
--- events.c	5 Jul 2007 04:12:14 -0000	1.386
+++ events.c	7 Jul 2007 15:45:56 -0000	1.387
@@ -3087,7 +3087,7 @@
 
 			gg_debug(GG_DEBUG_MISC, "// ekg: trying to save image: %s\n", path);
 
-			fd = open(path, O_WRONLY | O_CREAT, 0600);
+			fd = open(path, O_WRONLY | O_CREAT, config_files_mode_received);
 			if (fd == -1)
 				goto err;
 

Index: log.c
===================================================================
RCS file: /home/cvs/ekg/src/log.c,v
diff -d -u -r1.9 -r1.10
--- log.c	29 Jul 2006 18:31:00 -0000	1.9
+++ log.c	7 Jul 2007 15:45:56 -0000	1.10
@@ -390,7 +390,7 @@
 			if (gzclose(f) != Z_OK)
 				goto fail;
 
-			chmod(path, 0600);
+			chmod(path, config_files_mode_config);
 
 			goto cleanup;
 		}
@@ -402,7 +402,7 @@
 	fputs(buf, f);
 	if (fclose(f) != 0)
 		goto fail;
-	chmod(path, 0600);
+	chmod(path, config_files_mode_config);
 
 cleanup:
 	xfree(buf);

Index: msgqueue.c
===================================================================
RCS file: /home/cvs/ekg/src/msgqueue.c,v
diff -d -u -r1.18 -r1.19
--- msgqueue.c	29 Jul 2006 18:31:00 -0000	1.18
+++ msgqueue.c	7 Jul 2007 15:45:56 -0000	1.19
@@ -310,7 +310,7 @@
 		fprintf(f, "%s", m->msg);
 
 		fclose(f);
-		chmod(fn, 0600);
+		chmod(fn, config_files_mode_config);
 		xfree(fn);
 	}
 

Index: stuff.c
===================================================================
RCS file: /home/cvs/ekg/src/stuff.c,v
diff -d -u -r1.463 -r1.464
--- stuff.c	13 Jun 2007 12:26:03 -0000	1.463
+++ stuff.c	7 Jul 2007 15:45:56 -0000	1.464
@@ -113,6 +113,10 @@
 int config_beep_mail = 1;
 int config_display_pl_chars = 1;
 int config_events_delay = 3;
+int config_files_mode_config_int = 600;	/* nie 0600, bo jest zamieniane z dec na oct */
+int config_files_mode_config = 0600;		/* wartosc oktalna files_mode_config */
+int config_files_mode_received_int = 600;
+int config_files_mode_received = 0600;
 char *config_sound_msg_file = NULL;
 char *config_sound_chat_file = NULL;
 char *config_sound_sysmsg_file = NULL;
@@ -919,6 +923,22 @@
 }
 
 /*
+ * changed_files_mode()
+ *
+ * funkcja wywołwana przy zmianie config_files_mode_*_int
+ */
+void changed_files_mode(const char *var)
+{
+	char mode[16];
+
+	snprintf(mode, sizeof(mode), "%d", config_files_mode_config_int);
+	config_files_mode_config = strtol(mode, NULL, 8);
+
+	snprintf(mode, sizeof(mode), "%d", config_files_mode_received_int);
+	config_files_mode_received = strtol(mode, NULL, 8);
+}
+
+/*
  * conference_add()
  *
  * dopisuje konferencje do listy konferencji.
@@ -2613,7 +2633,7 @@
 	if (!stat(pipe_file, &st) && !S_ISFIFO(st.st_mode))
 		err_str = saprintf("Plik %s nie jest potokiem. Ignoruję.\n", pipe_file);
 
-	if (mkfifo(pipe_file, 0600) < 0 && errno != EEXIST)
+	if (mkfifo(pipe_file, config_files_mode_config) < 0 && errno != EEXIST)
 		err_str = saprintf("Nie mogę stworzyć potoku %s: %s. Ignoruję.\n", pipe_file, strerror(errno));
 
 	if ((fd = open(pipe_file, O_RDWR | O_NONBLOCK)) < 0)

Index: stuff.h
===================================================================
RCS file: /home/cvs/ekg/src/stuff.h,v
diff -d -u -r1.289 -r1.290
--- stuff.h	5 Jul 2007 04:12:14 -0000	1.289
+++ stuff.h	7 Jul 2007 15:45:57 -0000	1.290
@@ -273,6 +273,10 @@
 int config_encryption;
 int config_enter_scrolls;
 int config_events_delay;
+int config_files_mode_config;
+int config_files_mode_received;
+int config_files_mode_config_int;
+int config_files_mode_received_int;
 char *config_interface;
 int config_header_size;
 int config_ignore_unknown_sender;
@@ -414,6 +418,7 @@
 void changed_theme(const char *var);
 void changed_uin(const char *var);
 void changed_xxx_reason(const char *var);
+void changed_files_mode(const char *var);
 
 struct conference *conference_add(const char *string, const char *nicklist, int quiet);
 int conference_remove(const char *name, int quiet);

Index: userlist.c
===================================================================
RCS file: /home/cvs/ekg/src/userlist.c,v
diff -d -u -r1.99 -r1.100
--- userlist.c	27 Apr 2007 18:52:28 -0000	1.99
+++ userlist.c	7 Jul 2007 15:45:57 -0000	1.100
@@ -403,7 +403,7 @@
 		return -2;
 	}
 
-	fchmod(fileno(f), 0600);
+	fchmod(fileno(f), config_files_mode_config);
 	
 	fputs(contacts, f);
 	xfree(contacts);
@@ -437,7 +437,7 @@
 	if (!(f = fopen(filename, "w")))
 		return -1;
 
-	fchmod(fileno(f), 0600);
+	fchmod(fileno(f), config_files_mode_config);
 	fprintf(f, "%s\n", (sess) ? "C" : "D");
 
 	for (l = userlist; l; l = l->next) {

Index: vars.c
===================================================================
RCS file: /home/cvs/ekg/src/vars.c,v
diff -d -u -r1.192 -r1.193
--- vars.c	27 Apr 2007 18:52:28 -0000	1.192
+++ vars.c	7 Jul 2007 15:45:57 -0000	1.193
@@ -236,6 +236,8 @@
 	variable_add("enter_scrolls", "es", VAR_BOOL, 2, NULL,  NULL, NULL, NULL);
 #endif
 	variable_add("events_delay", "ev", VAR_INT, 1, &config_events_delay, NULL, NULL, NULL);
+	variable_add("files_mode_config", "Mc", VAR_INT, 1, &config_files_mode_config_int, changed_files_mode, NULL, NULL);
+	variable_add("files_mode_received", "Mr", VAR_INT, 1, &config_files_mode_received_int, changed_files_mode, NULL, NULL);
 #ifdef WITH_UI_NCURSES
 	if (ui_init == ui_ncurses_init)
 		variable_add("header_size", "hs", VAR_INT, 1, &config_header_size, header_statusbar_resize, NULL, NULL);


More information about the ekg-commit mailing list