* Add option to specify number of retries for IMAP/POP3 stuff (via -r)
authorBrenden Matthews <brenden1@rty.ca>
Tue, 5 Aug 2008 18:00:30 +0000 (18:00 +0000)
committerBrenden Matthews <brenden1@rty.ca>
Tue, 5 Aug 2008 18:00:30 +0000 (18:00 +0000)
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1233 7f574dfc-610e-0410-a909-a81674777703

ChangeLog
README
doc/config_settings.xml
doc/conky.1
doc/variables.xml
src/conky.c
src/conky.h

index 91de82e..d4e43ba 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,10 @@
 # $Id$
 
+2008-08-05
+       * Add option to specify number of retries for IMAP/POP3 stuff (via -r)
+
 2008-08-03
-       * smaller $nvidia improvements
+       * Smaller $nvidia improvements
 
 2008-07-29
        * Added missing header to package dist
diff --git a/README b/README
index 26939f8..7060cc7 100644 (file)
--- a/README
+++ b/README
@@ -243,10 +243,11 @@ conky(1)                                                        conky(1)
 
 
        1mimap  22mDefault global IMAP server. Arguments are: "host user  pass  [-i
-             interval]  [-f  folder] [-p port] [-e command]". Default port is
-             143, default folder is ’INBOX’, default interval is  5  minutes.
-             If  the password is supplied as ’*’, you will be prompted to en‐
-             ter the password when Conky starts.
+             interval]  [-f folder] [-p port] [-e command] [-r retries]". De‐
+             fault port is 143, default folder is ’INBOX’,  default  interval
+             is  5 minutes, and default number of retries before giving up is
+             5. If the password is supplied as ’*’, you will be  prompted  to
+             enter the password when Conky starts.
 
 
        1mmail_spool0m
@@ -254,12 +255,12 @@ conky(1)                                                        conky(1)
 
 
        1mmax_port_monitor_connections0m
-             Allow each port monitor to track at most this  many  connections
+             Allow  each  port monitor to track at most this many connections
              (if 0 or not set, default is 256)
 
 
        1mmax_specials0m
-             Maximum  number  of special things, e.g. fonts, offsets, aligns,
+             Maximum number of special things, e.g. fonts,  offsets,  aligns,
              etc. (default is 512)
 
 
@@ -269,12 +270,12 @@ conky(1)                                                        conky(1)
 
 
        1mtext_buffer_size bytes0m
-             Size  of  the  standard text buffer (default is 256 bytes). This
-             buffer is used for intermediary text, such as individual  lines,
-             output  from $exec vars, and various other variables. Increasing
-             the size of this buffer can drastically reduce  Conky’s  perfor‐
-             mance,  but  will  allow for more text display per variable. The
-             size of this buffer cannot be smaller than the default value  of
+             Size of the standard text buffer (default is  256  bytes).  This
+             buffer  is used for intermediary text, such as individual lines,
+             output from $exec vars, and various other variables.  Increasing
+             the  size  of this buffer can drastically reduce Conky’s perfor‐
+             mance, but will allow for more text display  per  variable.  The
+             size  of this buffer cannot be smaller than the default value of
              256 bytes.
 
 
@@ -299,7 +300,7 @@ conky(1)                                                          conky(1)
 
 
        1mmusic_player_interval0m
-             Music  player thread update interval (defaults to Conky’s update
+             Music player thread update interval (defaults to Conky’s        update
              interval)
 
 
@@ -324,21 +325,21 @@ conky(1)                                                        conky(1)
 
 
        1mown_window_colour colour0m
-             If own_window_transparent no, set a specified background  colour
-             (defaults  to  black).  Takes  either a hex value (#ffffff) or a
+             If  own_window_transparent no, set a specified background colour
+             (defaults to black). Takes either a hex  value  (#ffffff)  or  a
              valid RGB name (see /usr/lib/X11/rgb.txt)
 
 
        1mown_window_hints undecorated,below,above,sticky,skip_taskbar,skip_pager0m
-             If own_window is yes, you may use these window manager hints  to
+             If  own_window is yes, you may use these window manager hints to
              affect the way Conky displays.  Notes: Use own_window_type desk‐
-             top as another way to implement many of these hints  implicitly.
-             If  you  use own_window_type override, window manager hints have
+             top  as another way to implement many of these hints implicitly.
+             If you use own_window_type override, window manager  hints  have
              no meaning and are ignored.
 
 
        1mown_window_title0m
-             Manually set the window name. Defaults to "<hostname> -  conky".
+             Manually  set the window name. Defaults to "<hostname> - conky".
 
 
        1mown_window_transparent0m
@@ -349,8 +350,8 @@ conky(1)                                                          conky(1)
              if own_window is yes, you may specify type normal, desktop, dock
              or override (default: normal).  Desktop windows are special win‐
              dows that have no window decorations; are always visible on your
-             desktop; do not appear in your pager or taskbar; and are  sticky
-             across  all workspaces.  Override windows are not under the con‐
+             desktop;  do not appear in your pager or taskbar; and are sticky
+             across all workspaces.  Override windows are not under the  con‐
              trol of the window manager. Hints are ignored. This type of win‐
              dow can be useful for certain situations.
 
@@ -363,10 +364,11 @@ conky(1)                                                        conky(1)
              Pad percentages to this many decimals (0 = no padding)
 
 
-       1mpop3  22mDefault  global  POP3 server. Arguments are: "host user pass [-i
-             interval] [-p port] [-e command]". Default port is 110,  default
-             interval  is  5 minutes. If the password is supplied as ’*’, you
-             will be prompted to enter the password when Conky starts.
+       1mpop3  22mDefault global POP3 server. Arguments are: "host user  pass  [-i
+             interval]  [-p port] [-e command] [-r retries]". Default port is
+             110, default interval is 5 minutes, and default  number  of  re‐
+             tries before giving up is 5. If the password is supplied as ’*’,
+             you will be prompted to enter the password when Conky starts.
 
 
        1mshort_units0m
@@ -983,8 +985,9 @@ conky(1)                                                          conky(1)
              Displays the number of messages in your global IMAP inbox by de‐
              fault.  You  can  define  individual  IMAP inboxes seperately by
              passing arguments to this object. Arguments are: "host user pass
-             [-i  interval] [-p port] [-e command]". Default port is 143, de‐
-             fault interval is 5 minutes. If the password is supplied as ’*’,
+             [-i interval] [-p port] [-e command] [-r retries]". Default port
+             is 143, default interval is 5 minutes, and default number of re‐
+             tries before giving up is 5. If the password is supplied as ’*’,
              you will be prompted to enter the password when Conky starts.
 
 
@@ -992,8 +995,9 @@ conky(1)                                                          conky(1)
              Displays the number of unseen messages in your global IMAP inbox
              by default. You can define individual IMAP inboxes seperately by
              passing arguments to this object. Arguments are: "host user pass
-             [-i interval] [-p port] [-e command]". Default port is 143,  de‐
-             fault interval is 5 minutes. If the password is supplied as ’*’,
+             [-i interval] [-p port] [-e command] [-r retries]". Default port
+             is 143, default interval is 5 minutes, and default number of re‐
+             tries before giving up is 5. If the password is supplied as ’*’,
              you will be prompted to enter the password when Conky starts.
 
 
@@ -1161,11 +1165,15 @@ conky(1)                                                              conky(1)
 
        1mnvidia threshold temp gpufreq memfreq imagequality0m
              Nvidia graficcard support for the XNVCtrl library.  Each  option
-             gives back one integer value: (threshold): the thresholdtempera‐
-             ture at which the gpu slows down (temp): gives the  gpu  current
-             temperature  (gpufreq):  gives  the  current gpu frequency (mem‐
-             freq): gives the current mem frequency (imagequality): which im‐
-             agequality should be choosen by OpenGL applications
+             can  be  shortened  to the least significant part.  Temperatures
+             are printed as float, all other values as integer.
+
+             1mthreshold22m: the thresholdtemperature at which the gpu slows down
+             1mtemp22m: gives the gpu current temperature
+             1mgpufreq22m: gives the current gpu frequency
+             1mmemfreq22m: gives the current mem frequency
+             1mimagequality22m: which imagequality should be choosen by OpenGL ap‐
+             plications
 
 
        1moutlinecolor (color)0m
@@ -1201,19 +1209,21 @@ conky(1)                                                              conky(1)
              Displays the number of unseen messages in your global POP3 inbox
              by default. You can define individual POP3 inboxes seperately by
              passing arguments to this object. Arguments are: "host user pass
-             [-i  interval] [-p port] [-e command]". Default port is 110, de‐
-             fault interval is 5 minutes. If the password is supplied as ’*’,
+             [-i interval] [-p port] [-e command] [-r retries]". Default port
+             is 110, default interval is 5 minutes, and default number of re‐
+             tries before giving up is 5. If the password is supplied as ’*’,
              you will be prompted to enter the password when Conky starts.
 
 
        1mpop3_used (args)0m
-             Displays  the amount of space (in MiB, 2^20) used in your global
-             POP3 inbox by default. You can define  individual  POP3  inboxes
-             seperately  by  passing arguments to this object. Arguments are:
-             "host user pass [-i interval] [-p port] [-e  command]".  Default
-             port  is  110, default interval is 5 minutes. If the password is
-             supplied as ’*’, you will be prompted to enter the password when
-             Conky starts.
+             Displays the amount of space (in MiB, 2^20) used in your  global
+             POP3  inbox  by  default. You can define individual POP3 inboxes
+             seperately by passing arguments to this object.  Arguments  are:
+             "host  user  pass  [-i  interval] [-p port] [-e command] [-r re‐
+             tries]". Default port is 110, default interval is 5 minutes, and
+             default number of retries before giving up is 5. If the password
+             is supplied as ’*’, you will be prompted to enter      the  password
+             when Conky starts.
 
 
        1mpre_exec shell command0m
index 2bffbe0..f3887d6 100644 (file)
        <varlistentry>
                <term><command><option>imap</option></command></term>
                <listitem>
-                       Default global IMAP server.  Arguments are: "host user pass [-i interval] [-f folder] [-p port] [-e command]".  Default port is 143, default folder is 'INBOX', default interval is 5 minutes.  If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
+                       Default global IMAP server.  Arguments are: "host user pass [-i interval] [-f folder] [-p port] [-e command] [-r retries]".  Default port is 143, default folder is 'INBOX', default interval is 5 minutes, and default number of retries before giving up is 5.  If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
                        <para></para></listitem>
        </varlistentry>
 
        <varlistentry>
                <term><command><option>pop3</option></command></term>
                <listitem>
-                       Default global POP3 server.  Arguments are: "host user pass [-i interval] [-p port] [-e command]".  Default port is 110, default interval is 5 minutes.  If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
+                       Default global POP3 server.  Arguments are: "host user pass [-i interval] [-p port] [-e command] [-r retries]".  Default port is 110, default interval is 5 minutes, and default number of retries before giving up is 5.  If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
                        <para></para></listitem>
        </varlistentry>
 
index 5891299..e50e368 100644 (file)
@@ -1,4 +1,4 @@
-'\" -*- coding: us-ascii -*-
+.\" -*- coding: us-ascii -*-
 .if \n(.g .ds T< \\FC
 .if \n(.g .ds T> \\F[\n[.fam]]
 .de URL
@@ -225,7 +225,7 @@ How strict should if_up be when testing an interface for being up? The value is
 
 .TP 
 \fB\*(T<\fBimap\fR\*(T>\fR
-Default global IMAP server. Arguments are: "host user pass [-i interval] [-f folder] [-p port] [-e command]". Default port is 143, default folder is 'INBOX', default interval is 5 minutes. If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
+Default global IMAP server. Arguments are: "host user pass [-i interval] [-f folder] [-p port] [-e command] [-r retries]". Default port is 143, default folder is 'INBOX', default interval is 5 minutes, and default number of retries before giving up is 5. If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
 
 .TP 
 \fB\*(T<\fBmail_spool\fR\*(T>\fR
@@ -328,7 +328,7 @@ Pad percentages to this many decimals (0 = no padding)
 
 .TP 
 \fB\*(T<\fBpop3\fR\*(T>\fR
-Default global POP3 server. Arguments are: "host user pass [-i interval] [-p port] [-e command]". Default port is 110, default interval is 5 minutes. If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
+Default global POP3 server. Arguments are: "host user pass [-i interval] [-p port] [-e command] [-r retries]". Default port is 110, default interval is 5 minutes, and default number of retries before giving up is 5. If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
 
 .TP 
 \fB\*(T<\fBshort_units\fR\*(T>\fR
@@ -835,11 +835,11 @@ if INTERFACE exists and is up, display everything between $if_up and the matchin
 
 .TP 
 \fB\*(T<\fBimap_messages\fR\*(T>\fR \*(T<\fB(args)\fR\*(T> 
-Displays the number of messages in your global IMAP inbox by default. You can define individual IMAP inboxes seperately by passing arguments to this object. Arguments are: "host user pass [-i interval] [-p port] [-e command]". Default port is 143, default interval is 5 minutes. If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
+Displays the number of messages in your global IMAP inbox by default. You can define individual IMAP inboxes seperately by passing arguments to this object. Arguments are: "host user pass [-i interval] [-p port] [-e command] [-r retries]". Default port is 143, default interval is 5 minutes, and default number of retries before giving up is 5. If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
 
 .TP 
 \fB\*(T<\fBimap_unseen\fR\*(T>\fR \*(T<\fB(args)\fR\*(T> 
-Displays the number of unseen messages in your global IMAP inbox by default. You can define individual IMAP inboxes seperately by passing arguments to this object. Arguments are: "host user pass [-i interval] [-p port] [-e command]". Default port is 143, default interval is 5 minutes. If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
+Displays the number of unseen messages in your global IMAP inbox by default. You can define individual IMAP inboxes seperately by passing arguments to this object. Arguments are: "host user pass [-i interval] [-p port] [-e command] [-r retries]". Default port is 143, default interval is 5 minutes, and default number of retries before giving up is 5. If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
 
 .TP 
 \fB\*(T<\fBioscheduler\fR\*(T>\fR \*(T<\fBdisk\fR\*(T> 
@@ -996,12 +996,23 @@ Hostname
 .TP 
 \fB\*(T<\fBnvidia\fR\*(T>\fR \*(T<\fBthreshold\fR\*(T> \*(T<\fBtemp\fR\*(T> \*(T<\fBgpufreq\fR\*(T> \*(T<\fBmemfreq\fR\*(T> \*(T<\fBimagequality\fR\*(T> 
 Nvidia graficcard support for the XNVCtrl library.
-Each option gives back one integer value:
-(threshold): the thresholdtemperature at which the gpu slows down
-(temp): gives the gpu current temperature
-(gpufreq): gives the current gpu frequency
-(memfreq): gives the current mem frequency
-(imagequality): which imagequality should be choosen by OpenGL applications
+Each option can be shortened to the least significant part.
+Temperatures are printed as float, all other values as integer.
+
+\fBthreshold\fR:
+the thresholdtemperature at which the gpu slows down
+.br
+\fBtemp\fR:
+gives the gpu current temperature
+.br
+\fBgpufreq\fR:
+gives the current gpu frequency
+.br
+\fBmemfreq\fR:
+gives the current mem frequency
+.br
+\fBimagequality\fR:
+which imagequality should be choosen by OpenGL applications
 
 .TP 
 \fB\*(T<\fBoutlinecolor\fR\*(T>\fR \*(T<\fB(color)\fR\*(T> 
@@ -1037,11 +1048,11 @@ Platform sensor from sysfs (Linux 2.6). Parameter dev may be omitted if you have
 
 .TP 
 \fB\*(T<\fBpop3_unseen\fR\*(T>\fR \*(T<\fB(args)\fR\*(T> 
-Displays the number of unseen messages in your global POP3 inbox by default. You can define individual POP3 inboxes seperately by passing arguments to this object. Arguments are: "host user pass [-i interval] [-p port] [-e command]". Default port is 110, default interval is 5 minutes. If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
+Displays the number of unseen messages in your global POP3 inbox by default. You can define individual POP3 inboxes seperately by passing arguments to this object. Arguments are: "host user pass [-i interval] [-p port] [-e command] [-r retries]". Default port is 110, default interval is 5 minutes, and default number of retries before giving up is 5. If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
 
 .TP 
 \fB\*(T<\fBpop3_used\fR\*(T>\fR \*(T<\fB(args)\fR\*(T> 
-Displays the amount of space (in MiB, 2^20) used in your global POP3 inbox by default. You can define individual POP3 inboxes seperately by passing arguments to this object. Arguments are: "host user pass [-i interval] [-p port] [-e command]". Default port is 110, default interval is 5 minutes. If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
+Displays the amount of space (in MiB, 2^20) used in your global POP3 inbox by default. You can define individual POP3 inboxes seperately by passing arguments to this object. Arguments are: "host user pass [-i interval] [-p port] [-e command] [-r retries]". Default port is 110, default interval is 5 minutes, and default number of retries before giving up is 5. If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
 
 .TP 
 \fB\*(T<\fBpre_exec\fR\*(T>\fR \*(T<\fBshell command\fR\*(T> 
index 54cf910..147cb78 100644 (file)
                        <option>(args)</option>
                </term>
                <listitem>
-                       Displays the number of messages in your global IMAP inbox by default.  You can define individual IMAP inboxes seperately by passing arguments to this object.  Arguments are: "host user pass [-i interval] [-p port] [-e command]".  Default port is 143, default interval is 5 minutes.  If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
+                       Displays the number of messages in your global IMAP inbox by default.  You can define individual IMAP inboxes seperately by passing arguments to this object.  Arguments are: "host user pass [-i interval] [-p port] [-e command] [-r retries]".  Default port is 143, default interval is 5 minutes, and default number of retries before giving up is 5.  If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
                        <para></para></listitem>
        </varlistentry>
 
                        <option>(args)</option>
                </term>
                <listitem>
-                       Displays the number of unseen messages in your global IMAP inbox by default.  You can define individual IMAP inboxes seperately by passing arguments to this object.  Arguments are: "host user pass [-i interval] [-p port] [-e command]".  Default port is 143, default interval is 5 minutes.  If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
+                       Displays the number of unseen messages in your global IMAP inbox by default.  You can define individual IMAP inboxes seperately by passing arguments to this object.  Arguments are: "host user pass [-i interval] [-p port] [-e command] [-r retries]".  Default port is 143, default interval is 5 minutes, and default number of retries before giving up is 5.  If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
                        <para></para></listitem>
        </varlistentry>
 
                        <option>(args)</option>
                </term>
                <listitem>
-                       Displays the number of unseen messages in your global POP3 inbox by default.  You can define individual POP3 inboxes seperately by passing arguments to this object.  Arguments are: "host user pass [-i interval] [-p port] [-e command]".  Default port is 110, default interval is 5 minutes.  If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
+                       Displays the number of unseen messages in your global POP3 inbox by default.  You can define individual POP3 inboxes seperately by passing arguments to this object.  Arguments are: "host user pass [-i interval] [-p port] [-e command] [-r retries]".  Default port is 110, default interval is 5 minutes, and default number of retries before giving up is 5.  If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
 
                        <para></para></listitem>
        </varlistentry>
                        <option>(args)</option>
                </term>
                <listitem>
-                       Displays the amount of space (in MiB, 2^20) used in your global POP3 inbox by default.  You can define individual POP3 inboxes seperately by passing arguments to this object.  Arguments are: "host user pass [-i interval] [-p port] [-e command]".  Default port is 110, default interval is 5 minutes.  If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
+                       Displays the amount of space (in MiB, 2^20) used in your global POP3 inbox by default.  You can define individual POP3 inboxes seperately by passing arguments to this object.  Arguments are: "host user pass [-i interval] [-p port] [-e command] [-r retries]".  Default port is 110, default interval is 5 minutes, and default number of retries before giving up is 5.  If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
 
                        <para></para></listitem>
        </varlistentry>
index e432aef..e830b68 100644 (file)
@@ -1575,6 +1575,13 @@ struct mail_s *parse_mail_args(char type, const char *arg)
                tcsetattr(fp, TCSANOW, &term);
        }
        // now we check for optional args
+       tmp = strstr(arg, "-r ");
+       if (tmp) {
+               tmp += 3;
+               sscanf(tmp, "%u", &mail->retries);
+       } else {
+               mail->retries = 5;      // 5 retries after failure
+       }
        tmp = strstr(arg, "-i ");
        if (tmp) {
                tmp += 3;
@@ -1648,7 +1655,7 @@ void *imap_thread(void *arg)
                exit(1);
        }
 #endif /* HAVE_GETHOSTBYNAME_R */
-       while (fail < 5) {
+       while (fail < mail->retries) {
                struct timeval timeout;
                int res;
                fd_set fdset;
@@ -1844,7 +1851,7 @@ void *pop3_thread(void *arg)
                exit(1);
        }
 #endif /* HAVE_GETHOSTBYNAME_R */
-       while (fail < 5) {
+       while (fail < mail->retries) {
                struct timeval timeout;
                int res;
                fd_set fdset;
index ba429f3..29410f4 100644 (file)
@@ -156,6 +156,7 @@ struct mail_s {                     // for imap and pop3
        unsigned long used;
        unsigned long quota;
        unsigned long port;
+       unsigned long retries;
        float interval;
        double last_update;
        char host[128];