comparison src/queue.c @ 422:bdbedce60247

Remove `input' dir in spool dir. Spooled files are in spool dir directly now. There's no more need to have any sub directories in the spool dir at all.
author markus schnalke <meillo@marmaro.de>
date Wed, 30 May 2012 10:27:10 +0200
parents b27f66555ba8
children
comparison
equal deleted inserted replaced
421:f37384470855 422:bdbedce60247
52 52
53 /* 53 /*
54 ** Escaping the question marks prevents them from being 54 ** Escaping the question marks prevents them from being
55 ** interpreted as trigraphs 55 ** interpreted as trigraphs
56 */ 56 */
57 pattern = g_strdup_printf("%s/input/?????\?-??\?-?\?-H", conf.spool_dir); 57 pattern = g_strdup_printf("%s/?????\?-??\?-?\?-H", conf.spool_dir);
58 gl.gl_offs = 0; 58 gl.gl_offs = 0;
59 glob(pattern, 0, NULL, &gl); 59 glob(pattern, 0, NULL, &gl);
60 60
61 g_free(pattern); 61 g_free(pattern);
62 62
71 mix_arr(idx_arr, gl.gl_pathc); 71 mix_arr(idx_arr, gl.gl_pathc);
72 72
73 for (i = 0; i < gl.gl_pathc; i++) { 73 for (i = 0; i < gl.gl_pathc; i++) {
74 gchar *uid; 74 gchar *uid;
75 75
76 /* copy 13 chars, offset spooldir path + 7 chars for /input/ */ 76 /* copy 13 chars, offset spooldir path + 1 char for / */
77 /* uid length = 6 chars + '-' + 3 chars + '-' + 2 = 13 chars */ 77 /* uid length = 6 chars + '-' + 3 chars + '-' + 2 = 13 chars */
78 uid = g_strndup(&(gl.gl_pathv[idx_arr[i]][strlen(conf.spool_dir) + 7]), 13); 78 uid = g_strndup(&(gl.gl_pathv[idx_arr[i]][strlen(conf.spool_dir) + 1]), 13);
79 79
80 DEBUG(5) debugf("uid: %s\n", uid); 80 DEBUG(5) debugf("uid: %s\n", uid);
81 81
82 msg_list = g_list_append(msg_list, msg_spool_read(uid)); 82 msg_list = g_list_append(msg_list, msg_spool_read(uid));
83 83
194 gboolean 194 gboolean
195 queue_delete(gchar *uid) 195 queue_delete(gchar *uid)
196 { 196 {
197 gboolean hdr_ok = TRUE; 197 gboolean hdr_ok = TRUE;
198 gboolean dat_ok = TRUE; 198 gboolean dat_ok = TRUE;
199 gchar *hdr_name = g_strdup_printf("%s/input/%s-H", conf.spool_dir, uid); 199 gchar *hdr_name = g_strdup_printf("%s/%s-H", conf.spool_dir, uid);
200 gchar *dat_name = g_strdup_printf("%s/input/%s-D", conf.spool_dir, uid); 200 gchar *dat_name = g_strdup_printf("%s/%s-D", conf.spool_dir, uid);
201 struct stat stat_buf; 201 struct stat stat_buf;
202 202
203 if (!spool_lock(uid)) { 203 if (!spool_lock(uid)) {
204 fprintf(stderr, "message %s is locked.\n", uid); 204 fprintf(stderr, "message %s is locked.\n", uid);
205 return FALSE; 205 return FALSE;