mailer: use PROGNAME_MAILER

This commit is contained in:
Pierre Pronchery 2024-09-10 02:20:58 +02:00
parent 6f3f8258ea
commit fba7942580

View File

@ -53,17 +53,20 @@
/* constants */ /* constants */
#ifndef PROGNAME_MAILER
# define PROGNAME_MAILER "mailer"
#endif
#ifndef PREFIX #ifndef PREFIX
# define PREFIX "/usr/local" # define PREFIX "/usr/local"
#endif #endif
#ifndef LIBDIR #ifndef LIBDIR
# define LIBDIR PREFIX "/lib" # define LIBDIR PREFIX "/lib"
#endif #endif
#ifndef PLUGINDIR #ifndef PLUGINDIR
# define PLUGINDIR LIBDIR "/Mailer" # define PLUGINDIR LIBDIR "/Mailer"
#endif #endif
#ifndef SYSCONFDIR #ifndef SYSCONFDIR
# define SYSCONFDIR PREFIX "/etc" # define SYSCONFDIR PREFIX "/etc"
#endif #endif
@ -373,7 +376,7 @@ Mailer * mailer_new(void)
if((mailer = object_new(sizeof(*mailer))) == NULL) if((mailer = object_new(sizeof(*mailer))) == NULL)
{ {
error_print("mailer"); error_print(PROGNAME_MAILER);
return NULL; return NULL;
} }
/* accounts */ /* accounts */
@ -636,7 +639,7 @@ static int _new_accounts(Mailer * mailer)
{ {
error_set_code(1, "%s: %s", dirname, strerror(errno)); error_set_code(1, "%s: %s", dirname, strerror(errno));
string_delete(dirname); string_delete(dirname);
return error_print("mailer"); return error_print(PROGNAME_MAILER);
} }
for(de = readdir(dir); de != NULL; de = readdir(dir)) for(de = readdir(dir); de != NULL; de = readdir(dir))
{ {
@ -648,21 +651,22 @@ static int _new_accounts(Mailer * mailer)
if((p = realloc(mailer->available, (mailer->available_cnt + 1) if((p = realloc(mailer->available, (mailer->available_cnt + 1)
* sizeof(*p))) == NULL) * sizeof(*p))) == NULL)
{ {
error_set_print("mailer", 1, "%s", strerror(errno)); error_set_print(PROGNAME_MAILER, 1, "%s",
strerror(errno));
continue; continue;
} }
mailer->available = p; mailer->available = p;
if((p[mailer->available_cnt] = account_new(NULL, de->d_name, if((p[mailer->available_cnt] = account_new(NULL, de->d_name,
NULL, NULL)) == NULL) NULL, NULL)) == NULL)
{ {
error_print("mailer"); error_print(PROGNAME_MAILER);
continue; continue;
} }
mailer->available_cnt++; mailer->available_cnt++;
} }
if(closedir(dir) != 0) if(closedir(dir) != 0)
ret = error_set_print("mailer", 1, "%s: %s", dirname, strerror( ret = error_set_print(PROGNAME_MAILER, 1, "%s: %s", dirname,
errno)); strerror(errno));
string_delete(dirname); string_delete(dirname);
return ret; return ret;
} }
@ -1114,7 +1118,7 @@ int mailer_error(Mailer * mailer, char const * message, int ret)
#endif #endif
if(mailer == NULL) if(mailer == NULL)
return error_set_print("mailer", ret, "%s", message); return error_set_print(PROGNAME_MAILER, ret, "%s", message);
#if GTK_CHECK_VERSION(2, 18, 0) #if GTK_CHECK_VERSION(2, 18, 0)
/* info bar */ /* info bar */
gtk_label_set_text(GTK_LABEL(mailer->fo_infobar_label), message); gtk_label_set_text(GTK_LABEL(mailer->fo_infobar_label), message);