X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fconfigfile.c;h=c9b96219ff4bcd69b21a03c16bf824da565d8bf1;hb=13245184b602d8040fa4ac14497e4456397d31a4;hp=be8f77acd1d1f213e3d8118b8d4c5a2d6328099f;hpb=a6c4c0c8d8224cdc455f0d184e91d0cf881f0077;p=dockapps%2Fwmnotify.git diff --git a/src/configfile.c b/src/configfile.c index be8f77a..c9b9621 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -3,30 +3,19 @@ * * Copyright (C) 2003 Hugo Villeneuve * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + * This file is released under the GPLv2 */ #if HAVE_CONFIG_H # include "config.h" #endif +#include +#include #include #include #include #include -#include #if STDC_HEADERS # include @@ -99,6 +88,10 @@ static void CreateDefaultConfigurationFile(char *file) "# Mail Check Interval (in minutes, default is 5 minutes).\n"); fprintf(fp, "#mailcheckdelay 5\n\n"); fprintf(fp, "# Default mail client (optional).\n"); + fprintf(fp, + "# Manual mail check: 0=double-click, 1=single-click (optional, default is " + "1).\n"); + fprintf(fp, "mailcheck_single_click 1\n\n"); fprintf(fp, "#mailclient sylpheed\n\n"); fprintf(fp, "# Audio notification, 0=disable, 1=enable (optional, default is " @@ -209,6 +202,7 @@ static void ParseConfigurationFile(FILE *file) wmnotify_infos.mail_check_interval = 60; /* 1 minute interval. */ wmnotify_infos.audible_notification = false; /* Disabled. */ wmnotify_infos.use_ssl = false; /* Disabled. */ + wmnotify_infos.mailcheck_single_click = 1; wmnotify_infos.mail_client_argv[0] = NULL; /* No default command. */ wmnotify_infos.audiofile[0] = '\0'; /* No default audio file. */ wmnotify_infos.volume = 100; /* 100% volume. */ @@ -283,7 +277,7 @@ static void ParseConfigurationFile(FILE *file) } else if (STREQ(token, "port")) { token = GetArguments("port", true); wmnotify_infos.port = - (u_int16_t) GetNumber(token, "port"); + (uint16_t) GetNumber(token, "port"); } else if (STREQ(token, "username")) { @@ -313,6 +307,20 @@ static void ParseConfigurationFile(FILE *file) } wmnotify_infos.mail_check_interval = (unsigned int)delay * 60; + } else if (STREQ(token, "mailcheck_single_click")) { + int number; + + token = GetArguments("mailcheck_single_click", true); + number = GetNumber(token, "mailcheck_single_click"); + if ((number == 0) || (number == 1)) { + wmnotify_infos.mailcheck_single_click = number; + } else { + fprintf(stderr, + "%s: Invalid value for for parameter 'mailcheck_single_click' in\n" + "configuration file (must be 0 or 1): %d\n", + PACKAGE, number); + exit(EXIT_FAILURE); + } } else if (STREQ(token, "mailclient")) { /* Multiple arguments */ token = GetArguments("mailclient", false);