mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-26 00:28:25 +00:00
imap and pop3 clients
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@626 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
2713d6f818
commit
589602aacf
@ -1,5 +1,8 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
|
2006-05-08
|
||||||
|
* Added simple POP3/IMAP mail clients
|
||||||
|
|
||||||
2006-04-23
|
2006-04-23
|
||||||
* Added support for PowerBook batteries
|
* Added support for PowerBook batteries
|
||||||
* Fixed broken $if/$else stuff
|
* Fixed broken $if/$else stuff
|
||||||
|
241
README
241
README
@ -153,7 +153,7 @@ CONFIGURATION SETTINGS
|
|||||||
|
|
||||||
|
|
||||||
on_bottom
|
on_bottom
|
||||||
Set conky on the bottom of all other applications
|
Set Conky on the bottom of all other applications
|
||||||
|
|
||||||
|
|
||||||
border_margin
|
border_margin
|
||||||
@ -213,6 +213,13 @@ CONFIGURATION SETTINGS
|
|||||||
at command line
|
at command line
|
||||||
|
|
||||||
|
|
||||||
|
imap 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.
|
||||||
|
|
||||||
|
|
||||||
no_buffers
|
no_buffers
|
||||||
Substract (file system) buffers from used memory?
|
Substract (file system) buffers from used memory?
|
||||||
|
|
||||||
@ -301,7 +308,7 @@ CONFIGURATION SETTINGS
|
|||||||
|
|
||||||
own_window_hints undecorated,below,above,sticky,skip_taskbar,skip_pager
|
own_window_hints undecorated,below,above,sticky,skip_taskbar,skip_pager
|
||||||
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-
|
affect the way Conky displays. Notes: Use own_window_type desk-
|
||||||
top as another way to implement many of these hints implicitly.
|
top as another way to implement many of these hints implicitly.
|
||||||
If you use own_window_type override, window manager hints have
|
If you use own_window_type override, window manager hints have
|
||||||
no meaning and are ignored.
|
no meaning and are ignored.
|
||||||
@ -315,12 +322,18 @@ CONFIGURATION SETTINGS
|
|||||||
Pad percentages to this many decimals (0 = no padding)
|
Pad percentages to this many decimals (0 = no padding)
|
||||||
|
|
||||||
|
|
||||||
|
pop3 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.
|
||||||
|
|
||||||
|
|
||||||
stippled_borders
|
stippled_borders
|
||||||
Border stippling (dashing) in pixels
|
Border stippling (dashing) in pixels
|
||||||
|
|
||||||
|
|
||||||
total_run_times
|
total_run_times
|
||||||
Total number of times for Conky to update before quitting. Zero
|
Total number of times for Conky to update before quitting. Zero
|
||||||
makes Conky run forever
|
makes Conky run forever
|
||||||
|
|
||||||
|
|
||||||
@ -356,7 +369,7 @@ CONFIGURATION SETTINGS
|
|||||||
|
|
||||||
xmms_player
|
xmms_player
|
||||||
Use specified player/plugin for the xmms status variables. Valid
|
Use specified player/plugin for the xmms status variables. Valid
|
||||||
items are: none, xmms, bmp, audacious and infopipe. (default is
|
items are: none, xmms, bmp, audacious and infopipe. (default is
|
||||||
none). Note that bmpx is currently handled separately.
|
none). Note that bmpx is currently handled separately.
|
||||||
|
|
||||||
|
|
||||||
@ -364,7 +377,7 @@ CONFIGURATION SETTINGS
|
|||||||
|
|
||||||
|
|
||||||
VARIABLES
|
VARIABLES
|
||||||
Colors are parsed using XParsecolor(), there might be a list of them:
|
Colors are parsed using XParsecolor(), there might be a list of them:
|
||||||
/usr/X11R6/lib/X11/rgb.txt. Also, http://sedition.com/perl/rgb.html
|
/usr/X11R6/lib/X11/rgb.txt. Also, http://sedition.com/perl/rgb.html
|
||||||
[http://sedition.com/perl/rgb.html]. Color can be also in #rrggbb for-
|
[http://sedition.com/perl/rgb.html]. Color can be also in #rrggbb for-
|
||||||
mat (hex). Note that when displaying bytes, power is 1024 and not 1000
|
mat (hex). Note that when displaying bytes, power is 1024 and not 1000
|
||||||
@ -415,12 +428,12 @@ VARIABLES
|
|||||||
|
|
||||||
|
|
||||||
apm_battery_time
|
apm_battery_time
|
||||||
Display remaining APM battery life in hh:mm:ss or "unknown" if
|
Display remaining APM battery life in hh:mm:ss or "unknown" if
|
||||||
AC adapterstatus is on-line or charging (FreeBSD only)
|
AC adapterstatus is on-line or charging (FreeBSD only)
|
||||||
|
|
||||||
|
|
||||||
battery (num)
|
battery (num)
|
||||||
Remaining capacity in ACPI or APM battery. ACPI battery number
|
Remaining capacity in ACPI or APM battery. ACPI battery number
|
||||||
can be given as argument (default is BAT0).
|
can be given as argument (default is BAT0).
|
||||||
|
|
||||||
|
|
||||||
@ -460,28 +473,28 @@ VARIABLES
|
|||||||
|
|
||||||
|
|
||||||
cpu (cpuN)
|
cpu (cpuN)
|
||||||
CPU usage in percents. For SMP machines, the CPU number can be
|
CPU usage in percents. For SMP machines, the CPU number can be
|
||||||
provided as an argument. cpu0 is the total usage, and >=cpu1 are
|
provided as an argument. cpu0 is the total usage, and >=cpu1 are
|
||||||
individual CPUs.
|
individual CPUs.
|
||||||
|
|
||||||
|
|
||||||
cpubar (cpu number) (height),(width)
|
cpubar (cpu number) (height),(width)
|
||||||
Bar that shows CPU usage, height is bar's height in pixels. See
|
Bar that shows CPU usage, height is bar's height in pixels. See
|
||||||
$cpu for more info on SMP.
|
$cpu for more info on SMP.
|
||||||
|
|
||||||
|
|
||||||
cpugraph (cpu number) (height),(width) (gradient colour 1) (gradient
|
cpugraph (cpu number) (height),(width) (gradient colour 1) (gradient
|
||||||
colour 2)
|
colour 2)
|
||||||
CPU usage graph, with optional colours in hex, minus the #. See
|
CPU usage graph, with optional colours in hex, minus the #. See
|
||||||
$cpu for more info on SMP.
|
$cpu for more info on SMP.
|
||||||
|
|
||||||
|
|
||||||
diskio Displays current disk IO.
|
diskio Displays current disk IO.
|
||||||
|
|
||||||
|
|
||||||
diskiograph (height),(width) (gradient colour 1) (gradient colour 2)
|
diskiograph (height),(width) (gradient colour 1) (gradient colour 2)
|
||||||
(scale)
|
(scale)
|
||||||
Disk IO graph, colours defined in hex, minus the #. If scale is
|
Disk IO graph, colours defined in hex, minus the #. If scale is
|
||||||
non-zero, it becomes the scale for the graph.
|
non-zero, it becomes the scale for the graph.
|
||||||
|
|
||||||
|
|
||||||
@ -495,7 +508,7 @@ VARIABLES
|
|||||||
|
|
||||||
downspeedgraph net (height),(width) (gradient colour 1) (gradient
|
downspeedgraph net (height),(width) (gradient colour 1) (gradient
|
||||||
colour 2) (scale)
|
colour 2) (scale)
|
||||||
Download speed graph, colours defined in hex, minus the #. If
|
Download speed graph, colours defined in hex, minus the #. If
|
||||||
scale is non-zero, it becomes the scale for the graph.
|
scale is non-zero, it becomes the scale for the graph.
|
||||||
|
|
||||||
|
|
||||||
@ -504,13 +517,13 @@ VARIABLES
|
|||||||
|
|
||||||
exec command
|
exec command
|
||||||
Executes a shell command and displays the output in conky. warn-
|
Executes a shell command and displays the output in conky. warn-
|
||||||
ing: this takes a lot more resources than other variables. I'd
|
ing: this takes a lot more resources than other variables. I'd
|
||||||
recommend coding wanted behaviour in C and posting a patch.
|
recommend coding wanted behaviour in C and posting a patch.
|
||||||
|
|
||||||
|
|
||||||
execbar command
|
execbar command
|
||||||
Same as exec, except if the first value return is a value
|
Same as exec, except if the first value return is a value
|
||||||
between 0-100, it will use that number for a bar. The size for
|
between 0-100, it will use that number for a bar. The size for
|
||||||
the bar is currently fixed, but that may change in the future.
|
the bar is currently fixed, but that may change in the future.
|
||||||
|
|
||||||
|
|
||||||
@ -519,7 +532,7 @@ VARIABLES
|
|||||||
|
|
||||||
|
|
||||||
execi interval command
|
execi interval command
|
||||||
Same as exec but with specific interval. Interval can't be less
|
Same as exec but with specific interval. Interval can't be less
|
||||||
than update_interval in configuration. See also $texeci
|
than update_interval in configuration. See also $texeci
|
||||||
|
|
||||||
|
|
||||||
@ -542,19 +555,19 @@ VARIABLES
|
|||||||
|
|
||||||
|
|
||||||
freq_dyn
|
freq_dyn
|
||||||
Returns CPU frequency in MHz, but is calculated by counting to
|
Returns CPU frequency in MHz, but is calculated by counting to
|
||||||
clock cycles to complete an instruction. Only available for
|
clock cycles to complete an instruction. Only available for
|
||||||
x86/amd64.
|
x86/amd64.
|
||||||
|
|
||||||
|
|
||||||
freq_dyn_g
|
freq_dyn_g
|
||||||
Returns CPU frequency in GHz, but is calculated by counting to
|
Returns CPU frequency in GHz, but is calculated by counting to
|
||||||
clock cycles to complete an instruction. Only available for
|
clock cycles to complete an instruction. Only available for
|
||||||
x86/amd64.
|
x86/amd64.
|
||||||
|
|
||||||
|
|
||||||
fs_bar (height),(width) fs
|
fs_bar (height),(width) fs
|
||||||
Bar that shows how much space is used on a file system. height
|
Bar that shows how much space is used on a file system. height
|
||||||
is the height in pixels. fs is any file on that file system.
|
is the height in pixels. fs is any file on that file system.
|
||||||
|
|
||||||
|
|
||||||
@ -575,8 +588,8 @@ VARIABLES
|
|||||||
|
|
||||||
|
|
||||||
head logfile lines (interval)
|
head logfile lines (interval)
|
||||||
Displays first N lines of supplied text text file. If interval
|
Displays first N lines of supplied text text file. If interval
|
||||||
is not supplied, Conky assumes 2x Conky's interval. Max of 30
|
is not supplied, Conky assumes 2x Conky's interval. Max of 30
|
||||||
lines can be displayed, or until the text buffer is filled.
|
lines can be displayed, or until the text buffer is filled.
|
||||||
|
|
||||||
|
|
||||||
@ -585,93 +598,113 @@ VARIABLES
|
|||||||
|
|
||||||
|
|
||||||
i2c (dev) type n
|
i2c (dev) type n
|
||||||
I2C sensor from sysfs (Linux 2.6). dev may be omitted if you
|
I2C sensor from sysfs (Linux 2.6). dev may be omitted if you
|
||||||
have only one I2C device. type is either in (or vol) meaning
|
have only one I2C device. type is either in (or vol) meaning
|
||||||
voltage, fan meaning fan or temp/tempf (first in C, second in F)
|
voltage, fan meaning fan or temp/tempf (first in C, second in F)
|
||||||
meaning temperature. n is number of the sensor. See
|
meaning temperature. n is number of the sensor. See
|
||||||
/sys/bus/i2c/devices/ on your local computer.
|
/sys/bus/i2c/devices/ on your local computer.
|
||||||
|
|
||||||
|
|
||||||
i8k_ac_status
|
i8k_ac_status
|
||||||
If running the i8k kernel driver for Inspiron laptops, displays
|
If running the i8k kernel driver for Inspiron laptops, displays
|
||||||
whether ac power is on, as listed in /proc/i8k (translated to
|
whether ac power is on, as listed in /proc/i8k (translated to
|
||||||
human-readable). Beware that this is by default not enabled by
|
human-readable). Beware that this is by default not enabled by
|
||||||
i8k itself.
|
i8k itself.
|
||||||
|
|
||||||
|
|
||||||
i8k_bios
|
i8k_bios
|
||||||
If running the i8k kernel driver for Inspiron laptops, displays
|
If running the i8k kernel driver for Inspiron laptops, displays
|
||||||
the bios version as listed in /proc/i8k.
|
the bios version as listed in /proc/i8k.
|
||||||
|
|
||||||
|
|
||||||
i8k_buttons_status
|
i8k_buttons_status
|
||||||
If running the i8k kernel driver for Inspiron laptops, displays
|
If running the i8k kernel driver for Inspiron laptops, displays
|
||||||
the volume buttons status as listed in /proc/i8k.
|
the volume buttons status as listed in /proc/i8k.
|
||||||
|
|
||||||
|
|
||||||
i8k_cpu_temp
|
i8k_cpu_temp
|
||||||
If running the i8k kernel driver for Inspiron laptops, displays
|
If running the i8k kernel driver for Inspiron laptops, displays
|
||||||
the cpu temperature in Celsius, as reported by /proc/i8k.
|
the cpu temperature in Celsius, as reported by /proc/i8k.
|
||||||
|
|
||||||
|
|
||||||
i8k_cpu_tempf
|
i8k_cpu_tempf
|
||||||
If running the i8k kernel driver for Inspiron laptops, displays
|
If running the i8k kernel driver for Inspiron laptops, displays
|
||||||
the cpu temperature in Farenheit, as reported by /proc/i8k.
|
the cpu temperature in Farenheit, as reported by /proc/i8k.
|
||||||
|
|
||||||
|
|
||||||
i8k_left_fan_rpm
|
i8k_left_fan_rpm
|
||||||
If running the i8k kernel driver for Inspiron laptops, displays
|
If running the i8k kernel driver for Inspiron laptops, displays
|
||||||
the left fan's rate of rotation, in revolutions per minute as
|
the left fan's rate of rotation, in revolutions per minute as
|
||||||
listed in /proc/i8k. Beware, some laptops i8k reports these fans
|
listed in /proc/i8k. Beware, some laptops i8k reports these fans
|
||||||
in reverse order.
|
in reverse order.
|
||||||
|
|
||||||
|
|
||||||
i8k_left_fan_status
|
i8k_left_fan_status
|
||||||
If running the i8k kernel driver for Inspiron laptops, displays
|
If running the i8k kernel driver for Inspiron laptops, displays
|
||||||
the left fan status as listed in /proc/i8k (translated to human-
|
the left fan status as listed in /proc/i8k (translated to human-
|
||||||
readable). Beware, some laptops i8k reports these fans in
|
readable). Beware, some laptops i8k reports these fans in
|
||||||
reverse order.
|
reverse order.
|
||||||
|
|
||||||
|
|
||||||
i8k_right_fan_rpm
|
i8k_right_fan_rpm
|
||||||
If running the i8k kernel driver for Inspiron laptops, displays
|
If running the i8k kernel driver for Inspiron laptops, displays
|
||||||
the right fan's rate of rotation, in revolutions per minute as
|
the right fan's rate of rotation, in revolutions per minute as
|
||||||
listed in /proc/i8k. Beware, some laptops i8k reports these fans
|
listed in /proc/i8k. Beware, some laptops i8k reports these fans
|
||||||
in reverse order.
|
in reverse order.
|
||||||
|
|
||||||
|
|
||||||
i8k_right_fan_status
|
i8k_right_fan_status
|
||||||
If running the i8k kernel driver for Inspiron laptops, displays
|
If running the i8k kernel driver for Inspiron laptops, displays
|
||||||
the right fan status as listed in /proc/i8k (translated to
|
the right fan status as listed in /proc/i8k (translated to
|
||||||
human-readable). Beware, some laptops i8k reports these fans in
|
human-readable). Beware, some laptops i8k reports these fans in
|
||||||
reverse order.
|
reverse order.
|
||||||
|
|
||||||
|
|
||||||
i8k_serial
|
i8k_serial
|
||||||
If running the i8k kernel driver for Inspiron laptops, displays
|
If running the i8k kernel driver for Inspiron laptops, displays
|
||||||
your laptop serial number as listed in /proc/i8k.
|
your laptop serial number as listed in /proc/i8k.
|
||||||
|
|
||||||
|
|
||||||
i8k_version
|
i8k_version
|
||||||
If running the i8k kernel driver for Inspiron laptops, displays
|
If running the i8k kernel driver for Inspiron laptops, displays
|
||||||
the version formatting of /proc/i8k.
|
the version formatting of /proc/i8k.
|
||||||
|
|
||||||
|
|
||||||
if_running (process)
|
if_running (process)
|
||||||
if PROCESS is running, display everything if_running and the
|
if PROCESS is running, display everything if_running and the
|
||||||
matching $endif
|
matching $endif
|
||||||
|
|
||||||
|
|
||||||
if_existing (file)
|
if_existing (file)
|
||||||
if FILE exists, display everything between if_existing and the
|
if FILE exists, display everything between if_existing and the
|
||||||
matching $endif
|
matching $endif
|
||||||
|
|
||||||
|
|
||||||
if_mounted (mountpoint)
|
if_mounted (mountpoint)
|
||||||
if MOUNTPOINT is mounted, display everything between if_mounted
|
if MOUNTPOINT is mounted, display everything between if_mounted
|
||||||
and the matching $endif
|
and the matching $endif
|
||||||
|
|
||||||
|
|
||||||
|
imap_messages (args)
|
||||||
|
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 110,
|
||||||
|
default interval is 5 minutes. If the password is supplied as
|
||||||
|
'*', you will be prompted to enter the password when Conky
|
||||||
|
starts.
|
||||||
|
|
||||||
|
|
||||||
|
imap_unseen (args)
|
||||||
|
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 110,
|
||||||
|
default interval is 5 minutes. If the password is supplied as
|
||||||
|
'*', you will be prompted to enter the password when Conky
|
||||||
|
starts.
|
||||||
|
|
||||||
|
|
||||||
kernel Kernel version
|
kernel Kernel version
|
||||||
|
|
||||||
|
|
||||||
@ -688,8 +721,8 @@ VARIABLES
|
|||||||
Machine, i686 for example
|
Machine, i686 for example
|
||||||
|
|
||||||
|
|
||||||
mails Mail count in mail spool. You can use program like fetchmail to
|
mails Mail count in mail spool. You can use program like fetchmail to
|
||||||
get mails from some server using your favourite protocol. See
|
get mails from some server using your favourite protocol. See
|
||||||
also new_mails.
|
also new_mails.
|
||||||
|
|
||||||
|
|
||||||
@ -786,22 +819,42 @@ VARIABLES
|
|||||||
|
|
||||||
pb_battery item
|
pb_battery item
|
||||||
If running on Apple powerbook/ibook, display information on bat-
|
If running on Apple powerbook/ibook, display information on bat-
|
||||||
tery status. The item parameter specifies, what information to
|
tery status. The item parameter specifies, what information to
|
||||||
display. Exactly one item must be specified. Valid items are:
|
display. Exactly one item must be specified. Valid items are:
|
||||||
|
|
||||||
status: Display if battery is fully charged, charging, discharg-
|
status: Display if battery is fully charged, charging, discharg-
|
||||||
ing or absent (running on AC)
|
ing or absent (running on AC)
|
||||||
|
|
||||||
percent: Display charge of battery in percent, if charging or
|
percent: Display charge of battery in percent, if charging or
|
||||||
discharging. Nothing will be displayed, if battery is fully
|
discharging. Nothing will be displayed, if battery is fully
|
||||||
charged or absent.
|
charged or absent.
|
||||||
|
|
||||||
time: Display the time remaining until the battery will be fully
|
time: Display the time remaining until the battery will be fully
|
||||||
charged or discharged at current rate. Nothing is displayed, if
|
charged or discharged at current rate. Nothing is displayed, if
|
||||||
battery is absent or if it's present but fully charged and not
|
battery is absent or if it's present but fully charged and not
|
||||||
discharging.
|
discharging.
|
||||||
|
|
||||||
|
|
||||||
|
pop3_unseen (args)
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
pop3_used (args)
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
pre_exec shell command
|
pre_exec shell command
|
||||||
Executes a shell command one time before conky displays anything
|
Executes a shell command one time before conky displays anything
|
||||||
and puts output as text.
|
and puts output as text.
|
||||||
@ -865,20 +918,20 @@ VARIABLES
|
|||||||
lservice - local service name from /etc/services
|
lservice - local service name from /etc/services
|
||||||
|
|
||||||
The connection index provides you with access to each connection
|
The connection index provides you with access to each connection
|
||||||
in the port monitor. The monitor will return information for
|
in the port monitor. The monitor will return information for
|
||||||
index values from 0 to n-1 connections. Values higher than n-1
|
index values from 0 to n-1 connections. Values higher than n-1
|
||||||
are simply ignored. For the "count" item, the connection index
|
are simply ignored. For the "count" item, the connection index
|
||||||
must be omitted. It is required for all other items.
|
must be omitted. It is required for all other items.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
${tcp_portmon 6881 6999 count} - displays the number of connec-
|
${tcp_portmon 6881 6999 count} - displays the number of connec-
|
||||||
tions in the bittorrent port range
|
tions in the bittorrent port range
|
||||||
|
|
||||||
${tcp_portmon 22 22 rip 0} - displays the remote host ip of the
|
${tcp_portmon 22 22 rip 0} - displays the remote host ip of the
|
||||||
first sshd connection
|
first sshd connection
|
||||||
|
|
||||||
${tcp_portmon 22 22 rip 9} - displays the remote host ip of the
|
${tcp_portmon 22 22 rip 9} - displays the remote host ip of the
|
||||||
tenth sshd connection
|
tenth sshd connection
|
||||||
|
|
||||||
${tcp_portmon 1 1024 rhost 0} - displays the remote host name of
|
${tcp_portmon 1 1024 rhost 0} - displays the remote host name of
|
||||||
@ -887,22 +940,22 @@ VARIABLES
|
|||||||
${tcp_portmon 1 1024 rport 4} - displays the remote host port of
|
${tcp_portmon 1 1024 rport 4} - displays the remote host port of
|
||||||
the fifth connection on a privileged port
|
the fifth connection on a privileged port
|
||||||
|
|
||||||
${tcp_portmon 1 65535 lservice 14} - displays the local service
|
${tcp_portmon 1 65535 lservice 14} - displays the local service
|
||||||
name of the fifteenth connection in the range of all ports
|
name of the fifteenth connection in the range of all ports
|
||||||
|
|
||||||
Note that port monitor variables which share the same port range
|
Note that port monitor variables which share the same port range
|
||||||
actually refer to the same monitor, so many references to a sin-
|
actually refer to the same monitor, so many references to a sin-
|
||||||
gle port range for different items and different indexes all use
|
gle port range for different items and different indexes all use
|
||||||
the same monitor internally. In other words, the program avoids
|
the same monitor internally. In other words, the program avoids
|
||||||
creating redundant monitors.
|
creating redundant monitors.
|
||||||
|
|
||||||
texeci interval command
|
texeci interval command
|
||||||
Runs a command at an interval inside a thread and displays the
|
Runs a command at an interval inside a thread and displays the
|
||||||
output. Same as $execi, except the command is run inside a
|
output. Same as $execi, except the command is run inside a
|
||||||
thread. Use this if you have a slow script to keep Conky updat-
|
thread. Use this if you have a slow script to keep Conky updat-
|
||||||
ing. You should make the interval slightly longer then the time
|
ing. You should make the interval slightly longer then the time
|
||||||
it takes your script to execute. For example, if you have a
|
it takes your script to execute. For example, if you have a
|
||||||
script that take 5 seconds to execute, you should make the
|
script that take 5 seconds to execute, you should make the
|
||||||
interval at least 6 seconds. See also $execi.
|
interval at least 6 seconds. See also $execi.
|
||||||
|
|
||||||
|
|
||||||
@ -917,21 +970,21 @@ VARIABLES
|
|||||||
|
|
||||||
|
|
||||||
time (format)
|
time (format)
|
||||||
Local time, see man strftime to get more information about for-
|
Local time, see man strftime to get more information about for-
|
||||||
mat
|
mat
|
||||||
|
|
||||||
|
|
||||||
totaldown net
|
totaldown net
|
||||||
Total download, overflows at 4 GB on Linux with 32-bit arch and
|
Total download, overflows at 4 GB on Linux with 32-bit arch and
|
||||||
there doesn't seem to be a way to know how many times it has
|
there doesn't seem to be a way to know how many times it has
|
||||||
already done that before conky has started.
|
already done that before conky has started.
|
||||||
|
|
||||||
|
|
||||||
top type, num
|
top type, num
|
||||||
This takes arguments in the form:top (name) (number) Basically,
|
This takes arguments in the form:top (name) (number) Basically,
|
||||||
processes are ranked from highest to lowest in terms of cpu
|
processes are ranked from highest to lowest in terms of cpu
|
||||||
usage, which is what (num) represents. The types are: "name",
|
usage, which is what (num) represents. The types are: "name",
|
||||||
"pid", "cpu", and mem". There can be a max of 10 processes
|
"pid", "cpu", and mem". There can be a max of 10 processes
|
||||||
listed.
|
listed.
|
||||||
|
|
||||||
|
|
||||||
@ -955,9 +1008,9 @@ VARIABLES
|
|||||||
Upload speed in kilobytes with one decimal
|
Upload speed in kilobytes with one decimal
|
||||||
|
|
||||||
|
|
||||||
upspeedgraph net (height),(width) (gradient colour 1) (gradient colour
|
upspeedgraph net (height),(width) (gradient colour 1) (gradient colour
|
||||||
2) (scale)
|
2) (scale)
|
||||||
Upload speed graph, colours defined in hex, minus the #. If
|
Upload speed graph, colours defined in hex, minus the #. If
|
||||||
scale is non-zero, it becomes the scale for the graph.
|
scale is non-zero, it becomes the scale for the graph.
|
||||||
|
|
||||||
|
|
||||||
@ -981,7 +1034,7 @@ VARIABLES
|
|||||||
|
|
||||||
|
|
||||||
voffset (pixels)
|
voffset (pixels)
|
||||||
Change vertical offset by N pixels. Negative values will cause
|
Change vertical offset by N pixels. Negative values will cause
|
||||||
text to overlap. See also $offset.
|
text to overlap. See also $offset.
|
||||||
|
|
||||||
|
|
||||||
@ -994,12 +1047,12 @@ VARIABLES
|
|||||||
|
|
||||||
|
|
||||||
xmms_channels
|
xmms_channels
|
||||||
xmms / bmp / audacious / infopipe: number of audio channels of
|
xmms / bmp / audacious / infopipe: number of audio channels of
|
||||||
current tune
|
current tune
|
||||||
|
|
||||||
|
|
||||||
xmms_filename
|
xmms_filename
|
||||||
xmms / bmp / audacious / infopipe: full path and filename of
|
xmms / bmp / audacious / infopipe: full path and filename of
|
||||||
current tune
|
current tune
|
||||||
|
|
||||||
|
|
||||||
@ -1009,17 +1062,17 @@ VARIABLES
|
|||||||
|
|
||||||
|
|
||||||
xmms_length
|
xmms_length
|
||||||
xmms / bmp / audacious / infopipe: total length of current tune
|
xmms / bmp / audacious / infopipe: total length of current tune
|
||||||
as MM:SS
|
as MM:SS
|
||||||
|
|
||||||
|
|
||||||
xmms_length_seconds
|
xmms_length_seconds
|
||||||
xmms / bmp / audacious / infopipe: total length of current tune
|
xmms / bmp / audacious / infopipe: total length of current tune
|
||||||
in seconds
|
in seconds
|
||||||
|
|
||||||
|
|
||||||
xmms_playlist_position
|
xmms_playlist_position
|
||||||
xmms / bmp / audacious / infopipe: playlist position of current
|
xmms / bmp / audacious / infopipe: playlist position of current
|
||||||
tune
|
tune
|
||||||
|
|
||||||
|
|
||||||
@ -1028,12 +1081,12 @@ VARIABLES
|
|||||||
|
|
||||||
|
|
||||||
xmms_position
|
xmms_position
|
||||||
xmms / bmp / audacious / infopipe: MM:SS position of current
|
xmms / bmp / audacious / infopipe: MM:SS position of current
|
||||||
tune
|
tune
|
||||||
|
|
||||||
|
|
||||||
xmms_position_seconds
|
xmms_position_seconds
|
||||||
xmms / bmp / audacious / infopipe: position of current tune in
|
xmms / bmp / audacious / infopipe: position of current tune in
|
||||||
seconds
|
seconds
|
||||||
|
|
||||||
|
|
||||||
@ -1051,13 +1104,13 @@ VARIABLES
|
|||||||
|
|
||||||
|
|
||||||
ibm_temps N
|
ibm_temps N
|
||||||
If running the IBM ACPI, displays the temperatures from the IBM
|
If running the IBM ACPI, displays the temperatures from the IBM
|
||||||
temperature sensors (N=0..7) Sensor 0 is on the CPU, 3 is on the
|
temperature sensors (N=0..7) Sensor 0 is on the CPU, 3 is on the
|
||||||
GPU.
|
GPU.
|
||||||
|
|
||||||
|
|
||||||
ibm_volume
|
ibm_volume
|
||||||
If running the IBM ACPI, displays the "master" volume, con-
|
If running the IBM ACPI, displays the "master" volume, con-
|
||||||
trolled by the volume keys (0-14).
|
trolled by the volume keys (0-14).
|
||||||
|
|
||||||
|
|
||||||
@ -1080,11 +1133,11 @@ FILES
|
|||||||
BUGS
|
BUGS
|
||||||
Drawing to root or some other desktop window directly doesn't work with
|
Drawing to root or some other desktop window directly doesn't work with
|
||||||
all window managers. Especially doesn't work well with Gnome and it has
|
all window managers. Especially doesn't work well with Gnome and it has
|
||||||
been reported that it doesn't work with KDE either. Nautilus can be
|
been reported that it doesn't work with KDE either. Nautilus can be
|
||||||
disabled from drawing to desktop with program gconf-editor. Uncheck
|
disabled from drawing to desktop with program gconf-editor. Uncheck
|
||||||
show_desktop in /apps/nautilus/preferences/. There is -w switch in
|
show_desktop in /apps/nautilus/preferences/. There is -w switch in
|
||||||
Conky to set some specific window id. You might find xwininfo -tree
|
Conky to set some specific window id. You might find xwininfo -tree
|
||||||
useful to find the window to draw to. You can also use -o argument
|
useful to find the window to draw to. You can also use -o argument
|
||||||
which makes Conky to create its own window.
|
which makes Conky to create its own window.
|
||||||
|
|
||||||
SEE ALSO
|
SEE ALSO
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><command><option>on_bottom</option></command></term>
|
<term><command><option>on_bottom</option></command></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
Set conky on the bottom of all other applications
|
Set Conky on the bottom of all other applications
|
||||||
<para></para></listitem>
|
<para></para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@ -118,6 +118,13 @@
|
|||||||
<para></para></listitem>
|
<para></para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<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.
|
||||||
|
<para></para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><command><option>no_buffers</option></command></term>
|
<term><command><option>no_buffers</option></command></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
@ -266,7 +273,7 @@
|
|||||||
<option>undecorated,below,above,sticky,skip_taskbar,skip_pager</option>
|
<option>undecorated,below,above,sticky,skip_taskbar,skip_pager</option>
|
||||||
</term>
|
</term>
|
||||||
<listitem>
|
<listitem>
|
||||||
If own_window is yes, you may use these window manager hints to affect the way conky displays.
|
If own_window is yes, you may use these window manager hints to affect the way Conky displays.
|
||||||
Notes: Use own_window_type desktop as another way to implement many of these hints implicitly.
|
Notes: Use own_window_type desktop 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.
|
If you use own_window_type override, window manager hints have no meaning and are ignored.
|
||||||
<para></para></listitem>
|
<para></para></listitem>
|
||||||
@ -286,6 +293,13 @@
|
|||||||
<para></para></listitem>
|
<para></para></listitem>
|
||||||
</varlistentry>
|
</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.
|
||||||
|
<para></para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><command><option>stippled_borders</option></command></term>
|
<term><command><option>stippled_borders</option></command></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
|
28
doc/conky.1
28
doc/conky.1
@ -136,7 +136,7 @@ Boolean value, if true, Conky will be forked to background when started
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fBon_bottom\fR
|
\fBon_bottom\fR
|
||||||
Set conky on the bottom of all other applications
|
Set Conky on the bottom of all other applications
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fBborder_margin\fR
|
\fBborder_margin\fR
|
||||||
@ -194,6 +194,10 @@ Gap between right or left border of screen, same as passing -x at command line
|
|||||||
\fBgap_y\fR
|
\fBgap_y\fR
|
||||||
Gap between top or bottom border of screen, same as passing -y at command line
|
Gap between top or bottom border of screen, same as passing -y at command line
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fBimap\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.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fBno_buffers\fR
|
\fBno_buffers\fR
|
||||||
Substract (file system) buffers from used memory?
|
Substract (file system) buffers from used memory?
|
||||||
@ -276,7 +280,7 @@ If own_window_transparent no, set a specified background colour (defaults to bla
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fBown_window_hints\fR \fBundecorated,below,above,sticky,skip_taskbar,skip_pager\fR
|
\fBown_window_hints\fR \fBundecorated,below,above,sticky,skip_taskbar,skip_pager\fR
|
||||||
If own_window is yes, you may use these window manager hints to affect the way conky displays.
|
If own_window is yes, you may use these window manager hints to affect the way Conky displays.
|
||||||
Notes: Use own_window_type desktop as another way to implement many of these hints implicitly.
|
Notes: Use own_window_type desktop 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.
|
If you use own_window_type override, window manager hints have no meaning and are ignored.
|
||||||
|
|
||||||
@ -288,6 +292,10 @@ Print text to stdout.
|
|||||||
\fBpad_percents\fR
|
\fBpad_percents\fR
|
||||||
Pad percentages to this many decimals (0 = no padding)
|
Pad percentages to this many decimals (0 = no padding)
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fBpop3\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.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fBstippled_borders\fR
|
\fBstippled_borders\fR
|
||||||
Border stippling (dashing) in pixels
|
Border stippling (dashing) in pixels
|
||||||
@ -596,6 +604,14 @@ if FILE exists, display everything between if_existing and the matching $endif
|
|||||||
\fBif_mounted\fR \fB(mountpoint)\fR
|
\fBif_mounted\fR \fB(mountpoint)\fR
|
||||||
if MOUNTPOINT is mounted, display everything between if_mounted and the matching $endif
|
if MOUNTPOINT is mounted, display everything between if_mounted and the matching $endif
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fBimap_messages\fR \fB(args)\fR
|
||||||
|
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 110, default interval is 5 minutes. If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fBimap_unseen\fR \fB(args)\fR
|
||||||
|
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 110, default interval is 5 minutes. If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fBkernel\fR
|
\fBkernel\fR
|
||||||
Kernel version
|
Kernel version
|
||||||
@ -732,6 +748,14 @@ rate. Nothing is displayed, if battery is
|
|||||||
absent or if it's present but fully charged
|
absent or if it's present but fully charged
|
||||||
and not discharging.
|
and not discharging.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fBpop3_unseen\fR \fB(args)\fR
|
||||||
|
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.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fBpop3_used\fR \fB(args)\fR
|
||||||
|
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.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fBpre_exec\fR \fBshell command\fR
|
\fBpre_exec\fR \fBshell command\fR
|
||||||
Executes a shell command one time before conky displays anything and puts output as text.
|
Executes a shell command one time before conky displays anything and puts output as text.
|
||||||
|
@ -617,6 +617,26 @@
|
|||||||
<para></para></listitem>
|
<para></para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command><option>imap_messages</option></command>
|
||||||
|
<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 110, default interval is 5 minutes. 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>imap_unseen</option></command>
|
||||||
|
<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 110, default interval is 5 minutes. If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
|
||||||
|
<para></para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>
|
<term>
|
||||||
<command><option>kernel</option></command>
|
<command><option>kernel</option></command>
|
||||||
@ -905,6 +925,28 @@
|
|||||||
<para></para></listitem>
|
<para></para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command><option>pop3_unseen</option></command>
|
||||||
|
<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.
|
||||||
|
|
||||||
|
<para></para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command><option>pop3_used</option></command>
|
||||||
|
<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.
|
||||||
|
|
||||||
|
<para></para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>
|
<term>
|
||||||
<command><option>pre_exec</option></command>
|
<command><option>pre_exec</option></command>
|
||||||
|
890
src/conky.c
890
src/conky.c
@ -17,6 +17,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <termios.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#if HAVE_DIRENT_H
|
#if HAVE_DIRENT_H
|
||||||
@ -870,6 +871,12 @@ enum text_object_type {
|
|||||||
OBJ_upspeedgraph,
|
OBJ_upspeedgraph,
|
||||||
OBJ_uptime,
|
OBJ_uptime,
|
||||||
OBJ_uptime_short,
|
OBJ_uptime_short,
|
||||||
|
OBJ_imap,
|
||||||
|
OBJ_imap_messages,
|
||||||
|
OBJ_imap_unseen,
|
||||||
|
OBJ_pop3,
|
||||||
|
OBJ_pop3_unseen,
|
||||||
|
OBJ_pop3_used,
|
||||||
#if defined(__FreeBSD__) && (defined(i386) || defined(__i386__))
|
#if defined(__FreeBSD__) && (defined(i386) || defined(__i386__))
|
||||||
OBJ_apm_adapter,
|
OBJ_apm_adapter,
|
||||||
OBJ_apm_battery_time,
|
OBJ_apm_battery_time,
|
||||||
@ -950,24 +957,22 @@ enum text_object_type {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
struct thread_info_s {
|
|
||||||
pthread_t thread;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct text_object {
|
struct text_object {
|
||||||
int type;
|
int type;
|
||||||
int a, b;
|
int a, b;
|
||||||
unsigned int c, d, e;
|
unsigned int c, d, e;
|
||||||
float f;
|
float f;
|
||||||
|
char global_mode;
|
||||||
union {
|
union {
|
||||||
char *s; /* some string */
|
char *s; /* some string */
|
||||||
int i; /* some integer */
|
int i; /* some integer */
|
||||||
long l; /* some other integer */
|
long l; /* some other integer */
|
||||||
unsigned int sensor;
|
unsigned int sensor;
|
||||||
struct net_stat *net;
|
struct net_stat *net;
|
||||||
struct fs_stat *fs;
|
struct fs_stat *fs;
|
||||||
unsigned char loadavg[3];
|
unsigned char loadavg[3];
|
||||||
unsigned int cpu_index;
|
unsigned int cpu_index;
|
||||||
|
struct mail_s *mail;
|
||||||
struct {
|
struct {
|
||||||
struct fs_stat *fs;
|
struct fs_stat *fs;
|
||||||
int w, h;
|
int w, h;
|
||||||
@ -1061,6 +1066,416 @@ void replace_thread(struct thread_info_s *new_thread, int pos) // this isn't eve
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define MAXDATASIZE 1000
|
||||||
|
|
||||||
|
void *imap_thread(struct mail_s* mail)
|
||||||
|
{ // pthreads are really beginning to piss me off
|
||||||
|
double update_time;
|
||||||
|
int run_code = threads_runnable;
|
||||||
|
update_time = get_time();
|
||||||
|
int sockfd, numbytes;
|
||||||
|
char recvbuf[MAXDATASIZE];
|
||||||
|
char sendbuf[MAXDATASIZE];
|
||||||
|
char *reply;
|
||||||
|
int fail = 0;
|
||||||
|
unsigned int old_unseen = UINT_MAX;
|
||||||
|
struct hostent *he;
|
||||||
|
struct sockaddr_in their_addr; // connector's address information
|
||||||
|
if ((he = gethostbyname(mail->host)) == NULL) { // get the host info
|
||||||
|
herror("gethostbyname");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
while (threads_runnable == run_code && fail < 5) {
|
||||||
|
update_time = get_time();
|
||||||
|
if ((sockfd = socket(PF_INET, SOCK_STREAM, 0)) == -1) {
|
||||||
|
perror("socket");
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
their_addr.sin_family = AF_INET; // host byte order
|
||||||
|
their_addr.sin_port = htons(mail->port); // short, network byte order
|
||||||
|
their_addr.sin_addr = *((struct in_addr *) he->h_addr);
|
||||||
|
memset(&(their_addr.sin_zero), '\0', 8); // zero the rest of the struct
|
||||||
|
|
||||||
|
if (connect
|
||||||
|
(sockfd, (struct sockaddr *) &their_addr,
|
||||||
|
sizeof(struct sockaddr)) == -1) {
|
||||||
|
perror("connect");
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
struct timeval timeout;
|
||||||
|
int res;
|
||||||
|
fd_set fdset;
|
||||||
|
timeout.tv_sec = 60; // 60 second timeout i guess
|
||||||
|
timeout.tv_usec = 0;
|
||||||
|
FD_ZERO(&fdset);
|
||||||
|
FD_SET(sockfd, &fdset);
|
||||||
|
res = select(sockfd + 1, &fdset, NULL, NULL, &timeout);
|
||||||
|
if (res > 0) {
|
||||||
|
if ((numbytes =
|
||||||
|
recv(sockfd, recvbuf, MAXDATASIZE - 1,
|
||||||
|
0)) == -1) {
|
||||||
|
perror("recv");
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ERR("IMAP connection failed: timeout\n");
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
recvbuf[numbytes] = '\0';
|
||||||
|
if (strstr(recvbuf, "* OK") != recvbuf) {
|
||||||
|
ERR("IMAP connection failed, probably not an IMAP server\n");
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
strncpy(sendbuf, "a1 login ", MAXDATASIZE);
|
||||||
|
strncat(sendbuf, mail->user,
|
||||||
|
MAXDATASIZE - strlen(sendbuf) - 1);
|
||||||
|
strncat(sendbuf, " ", MAXDATASIZE - strlen(sendbuf) - 1);
|
||||||
|
strncat(sendbuf, mail->pass,
|
||||||
|
MAXDATASIZE - strlen(sendbuf) - 1);
|
||||||
|
strncat(sendbuf, "\n", MAXDATASIZE - strlen(sendbuf) - 1);
|
||||||
|
if (send(sockfd, sendbuf, strlen(sendbuf), 0) == -1) {
|
||||||
|
perror("send a1");
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
timeout.tv_sec = 60; // 60 second timeout i guess
|
||||||
|
timeout.tv_usec = 0;
|
||||||
|
FD_ZERO(&fdset);
|
||||||
|
FD_SET(sockfd, &fdset);
|
||||||
|
res = select(sockfd + 1, &fdset, NULL, NULL, &timeout);
|
||||||
|
if (res > 0) {
|
||||||
|
if ((numbytes =
|
||||||
|
recv(sockfd, recvbuf, MAXDATASIZE - 1,
|
||||||
|
0)) == -1) {
|
||||||
|
perror("recv a1");
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
recvbuf[numbytes] = '\0';
|
||||||
|
if (strstr(recvbuf, "a1 OK") == NULL) {
|
||||||
|
ERR("IMAP server login failed: %s\n", recvbuf);
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
strncpy(sendbuf, "a2 STATUS ", MAXDATASIZE);
|
||||||
|
strncat(sendbuf, mail->folder,
|
||||||
|
MAXDATASIZE - strlen(sendbuf) - 1);
|
||||||
|
strncat(sendbuf, " (MESSAGES UNSEEN)\n",
|
||||||
|
MAXDATASIZE - strlen(sendbuf) - 1);
|
||||||
|
if (send(sockfd, sendbuf, strlen(sendbuf), 0) == -1) {
|
||||||
|
perror("send a2");
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
timeout.tv_sec = 60; // 60 second timeout i guess
|
||||||
|
timeout.tv_usec = 0;
|
||||||
|
FD_ZERO(&fdset);
|
||||||
|
FD_SET(sockfd, &fdset);
|
||||||
|
res = select(sockfd + 1, &fdset, NULL, NULL, &timeout);
|
||||||
|
if (res > 0) {
|
||||||
|
if ((numbytes =
|
||||||
|
recv(sockfd, recvbuf, MAXDATASIZE - 1,
|
||||||
|
0)) == -1) {
|
||||||
|
perror("recv a2");
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
recvbuf[numbytes] = '\0';
|
||||||
|
if (strstr(recvbuf, "a2 OK") == NULL) {
|
||||||
|
ERR("IMAP status failed: %s\n", recvbuf);
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// now we get the data
|
||||||
|
reply = strstr(recvbuf, " (MESSAGES ");
|
||||||
|
reply += 2;
|
||||||
|
*strchr(reply, ')') = '\0';
|
||||||
|
if (reply == NULL) {
|
||||||
|
ERR("Error parsing IMAP response: %s", recvbuf);
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
sscanf(reply, "MESSAGES %u UNSEEN %u",
|
||||||
|
&mail->messages,
|
||||||
|
&mail->unseen);
|
||||||
|
}
|
||||||
|
strncpy(sendbuf, "a3 logout\n", MAXDATASIZE);
|
||||||
|
if (send(sockfd, sendbuf, strlen(sendbuf), 0) == -1) {
|
||||||
|
perror("send a3");
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
timeout.tv_sec = 60; // 60 second timeout i guess
|
||||||
|
timeout.tv_usec = 0;
|
||||||
|
FD_ZERO(&fdset);
|
||||||
|
FD_SET(sockfd, &fdset);
|
||||||
|
res = select(sockfd + 1, &fdset, NULL, NULL, &timeout);
|
||||||
|
if (res > 0) {
|
||||||
|
if ((numbytes =
|
||||||
|
recv(sockfd, recvbuf, MAXDATASIZE - 1,
|
||||||
|
0)) == -1) {
|
||||||
|
perror("recv a3");
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
recvbuf[numbytes] = '\0';
|
||||||
|
if (strstr(recvbuf, "a3 OK") == NULL) {
|
||||||
|
ERR("IMAP logout failed: %s\n", recvbuf);
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
close(sockfd);
|
||||||
|
if (strlen(mail->command) > 1 && mail->unseen > old_unseen) { // new mail goodie
|
||||||
|
if (system(mail->command) == -1) {
|
||||||
|
perror("system()");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fail = 0;
|
||||||
|
old_unseen = mail->unseen;
|
||||||
|
mail->last_update = update_time;
|
||||||
|
usleep(100); // prevent race condition
|
||||||
|
if (get_time() - mail->last_update >
|
||||||
|
mail->interval) {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
unsigned int delay =
|
||||||
|
1000000.0 * (mail->interval -
|
||||||
|
(get_time() -
|
||||||
|
mail->last_update));
|
||||||
|
if (delay < update_interval * 500000) {
|
||||||
|
delay = update_interval * 1000000;
|
||||||
|
}
|
||||||
|
usleep(delay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ERR("exiting imap thread");
|
||||||
|
pthread_exit(NULL);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *pop3_thread(struct mail_s *mail)
|
||||||
|
{ // pthreads are really beginning to piss me off
|
||||||
|
double update_time;
|
||||||
|
int run_code = threads_runnable;
|
||||||
|
update_time = get_time();
|
||||||
|
int sockfd, numbytes;
|
||||||
|
char recvbuf[MAXDATASIZE];
|
||||||
|
char sendbuf[MAXDATASIZE];
|
||||||
|
char *reply;
|
||||||
|
int fail = 0;
|
||||||
|
unsigned int old_unseen = UINT_MAX;
|
||||||
|
struct hostent *he;
|
||||||
|
struct sockaddr_in their_addr; // connector's address information
|
||||||
|
if ((he = gethostbyname(mail->host)) == NULL) { // get the host info
|
||||||
|
herror("gethostbyname");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
while (threads_runnable == run_code && fail < 5) {
|
||||||
|
update_time = get_time();
|
||||||
|
if ((sockfd = socket(PF_INET, SOCK_STREAM, 0)) == -1) {
|
||||||
|
perror("socket");
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
their_addr.sin_family = AF_INET; // host byte order
|
||||||
|
their_addr.sin_port = htons(mail->port); // short, network byte order
|
||||||
|
their_addr.sin_addr = *((struct in_addr *) he->h_addr);
|
||||||
|
memset(&(their_addr.sin_zero), '\0', 8); // zero the rest of the struct
|
||||||
|
|
||||||
|
if (connect
|
||||||
|
(sockfd, (struct sockaddr *) &their_addr,
|
||||||
|
sizeof(struct sockaddr)) == -1) {
|
||||||
|
perror("connect");
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
struct timeval timeout;
|
||||||
|
int res;
|
||||||
|
fd_set fdset;
|
||||||
|
timeout.tv_sec = 60; // 60 second timeout i guess
|
||||||
|
timeout.tv_usec = 0;
|
||||||
|
FD_ZERO(&fdset);
|
||||||
|
FD_SET(sockfd, &fdset);
|
||||||
|
res = select(sockfd + 1, &fdset, NULL, NULL, &timeout);
|
||||||
|
if (res > 0) {
|
||||||
|
if ((numbytes =
|
||||||
|
recv(sockfd, recvbuf, MAXDATASIZE - 1,
|
||||||
|
0)) == -1) {
|
||||||
|
perror("recv");
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ERR("POP3 connection failed: timeout\n");
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
recvbuf[numbytes] = '\0';
|
||||||
|
if (strstr(recvbuf, "+OK ") != recvbuf) {
|
||||||
|
ERR("POP3 connection failed, probably not a POP3 server\n");
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
strncpy(sendbuf, "USER ", MAXDATASIZE);
|
||||||
|
strncat(sendbuf, mail->user,
|
||||||
|
MAXDATASIZE - strlen(sendbuf) - 1);
|
||||||
|
strncat(sendbuf, "\n", MAXDATASIZE - strlen(sendbuf) - 1);
|
||||||
|
if (send(sockfd, sendbuf, strlen(sendbuf), 0) == -1) {
|
||||||
|
perror("send USER");
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
timeout.tv_sec = 60; // 60 second timeout i guess
|
||||||
|
timeout.tv_usec = 0;
|
||||||
|
FD_ZERO(&fdset);
|
||||||
|
FD_SET(sockfd, &fdset);
|
||||||
|
res = select(sockfd + 1, &fdset, NULL, NULL, &timeout);
|
||||||
|
if (res > 0) {
|
||||||
|
if ((numbytes =
|
||||||
|
recv(sockfd, recvbuf, MAXDATASIZE - 1,
|
||||||
|
0)) == -1) {
|
||||||
|
perror("recv USER");
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
recvbuf[numbytes] = '\0';
|
||||||
|
if (strstr(recvbuf, "+OK ") == NULL) {
|
||||||
|
ERR("POP3 server login failed: %s\n", recvbuf);
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
strncpy(sendbuf, "PASS ", MAXDATASIZE);
|
||||||
|
strncat(sendbuf, mail->pass,
|
||||||
|
MAXDATASIZE - strlen(sendbuf) - 1);
|
||||||
|
strncat(sendbuf, "\n", MAXDATASIZE - strlen(sendbuf) - 1);
|
||||||
|
if (send(sockfd, sendbuf, strlen(sendbuf), 0) == -1) {
|
||||||
|
perror("send PASS");
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
timeout.tv_sec = 60; // 60 second timeout i guess
|
||||||
|
timeout.tv_usec = 0;
|
||||||
|
FD_ZERO(&fdset);
|
||||||
|
FD_SET(sockfd, &fdset);
|
||||||
|
res = select(sockfd + 1, &fdset, NULL, NULL, &timeout);
|
||||||
|
if (res > 0) {
|
||||||
|
if ((numbytes =
|
||||||
|
recv(sockfd, recvbuf, MAXDATASIZE - 1,
|
||||||
|
0)) == -1) {
|
||||||
|
perror("recv PASS");
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
recvbuf[numbytes] = '\0';
|
||||||
|
if (strstr(recvbuf, "+OK ") == NULL) {
|
||||||
|
ERR("POP3 server login failed: %s\n", recvbuf);
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
strncpy(sendbuf, "STAT\n", MAXDATASIZE);
|
||||||
|
if (send(sockfd, sendbuf, strlen(sendbuf), 0) == -1) {
|
||||||
|
perror("send STAT");
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
timeout.tv_sec = 60; // 60 second timeout i guess
|
||||||
|
timeout.tv_usec = 0;
|
||||||
|
FD_ZERO(&fdset);
|
||||||
|
FD_SET(sockfd, &fdset);
|
||||||
|
res = select(sockfd + 1, &fdset, NULL, NULL, &timeout);
|
||||||
|
if (res > 0) {
|
||||||
|
if ((numbytes =
|
||||||
|
recv(sockfd, recvbuf, MAXDATASIZE - 1,
|
||||||
|
0)) == -1) {
|
||||||
|
perror("recv STAT");
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
recvbuf[numbytes] = '\0';
|
||||||
|
if (strstr(recvbuf, "+OK ") == NULL) {
|
||||||
|
ERR("POP3 status failed: %s\n", recvbuf);
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// now we get the data
|
||||||
|
reply = recvbuf + 4;
|
||||||
|
if (reply == NULL) {
|
||||||
|
ERR("Error parsing POP3 response: %s", recvbuf);
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
sscanf(reply, "%u %u", &mail->unseen,
|
||||||
|
&mail->used);
|
||||||
|
}
|
||||||
|
strncpy(sendbuf, "QUIT\n", MAXDATASIZE);
|
||||||
|
if (send(sockfd, sendbuf, strlen(sendbuf), 0) == -1) {
|
||||||
|
perror("send QUIT");
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
timeout.tv_sec = 60; // 60 second timeout i guess
|
||||||
|
timeout.tv_usec = 0;
|
||||||
|
FD_ZERO(&fdset);
|
||||||
|
FD_SET(sockfd, &fdset);
|
||||||
|
res = select(sockfd + 1, &fdset, NULL, NULL, &timeout);
|
||||||
|
if (res > 0) {
|
||||||
|
if ((numbytes =
|
||||||
|
recv(sockfd, recvbuf, MAXDATASIZE - 1,
|
||||||
|
0)) == -1) {
|
||||||
|
perror("recv QUIT");
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
recvbuf[numbytes] = '\0';
|
||||||
|
if (strstr(recvbuf, "+OK") == NULL) {
|
||||||
|
ERR("POP3 logout failed: %s\n", recvbuf);
|
||||||
|
fail++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
close(sockfd);
|
||||||
|
if (strlen(mail->command) > 1 && mail->unseen > old_unseen) { // new mail goodie
|
||||||
|
if (system(mail->command) == -1) {
|
||||||
|
perror("system()");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fail = 0;
|
||||||
|
old_unseen = mail->unseen;
|
||||||
|
mail->last_update = update_time;
|
||||||
|
usleep(100); // prevent race condition
|
||||||
|
if (get_time() - mail->last_update >
|
||||||
|
mail->interval) {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
unsigned int delay =
|
||||||
|
1000000.0 * (mail->interval -
|
||||||
|
(get_time() -
|
||||||
|
mail->last_update));
|
||||||
|
if (delay < update_interval * 500000) {
|
||||||
|
delay = update_interval * 1000000;
|
||||||
|
}
|
||||||
|
usleep(delay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ERR("exiting pop3 thread");
|
||||||
|
pthread_exit(NULL);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void *threaded_exec(struct text_object *obj) { // pthreads are really beginning to piss me off
|
void *threaded_exec(struct text_object *obj) { // pthreads are really beginning to piss me off
|
||||||
double update_time;
|
double update_time;
|
||||||
int run_code = threads_runnable;
|
int run_code = threads_runnable;
|
||||||
@ -1132,6 +1547,32 @@ static void free_text_objects(unsigned int count, struct text_object *objs)
|
|||||||
free(objs[i].data.s);
|
free(objs[i].data.s);
|
||||||
break;
|
break;
|
||||||
case OBJ_utime:
|
case OBJ_utime:
|
||||||
|
case OBJ_imap:
|
||||||
|
free(info.mail);
|
||||||
|
break;
|
||||||
|
case OBJ_imap_unseen:
|
||||||
|
if (!objs[i].global_mode) {
|
||||||
|
free(objs[i].data.mail);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OBJ_imap_messages:
|
||||||
|
if (!objs[i].global_mode) {
|
||||||
|
free(objs[i].data.mail);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OBJ_pop3:
|
||||||
|
free(info.mail);
|
||||||
|
break;
|
||||||
|
case OBJ_pop3_unseen:
|
||||||
|
if (!objs[i].global_mode) {
|
||||||
|
free(objs[i].data.mail);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OBJ_pop3_used:
|
||||||
|
if (!objs[i].global_mode) {
|
||||||
|
free(objs[i].data.mail);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case OBJ_if_existing:
|
case OBJ_if_existing:
|
||||||
case OBJ_if_mounted:
|
case OBJ_if_mounted:
|
||||||
case OBJ_if_running:
|
case OBJ_if_running:
|
||||||
@ -2027,6 +2468,244 @@ static struct text_object *construct_text_object(const char *s, const char *arg,
|
|||||||
(void) scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b);
|
(void) scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b);
|
||||||
END OBJ(seti_credit, INFO_SETI) END
|
END OBJ(seti_credit, INFO_SETI) END
|
||||||
#endif
|
#endif
|
||||||
|
OBJ(imap_unseen, 0)
|
||||||
|
if (arg) {
|
||||||
|
// proccss
|
||||||
|
obj->data.mail = malloc(sizeof(struct mail_s));
|
||||||
|
char *tmp;
|
||||||
|
if (sscanf(arg, "%128s %128s %128s", obj->data.mail->host, obj->data.mail->user, obj->data.mail->pass) != 3) {
|
||||||
|
ERR("Scanning IMAP args failed");
|
||||||
|
}
|
||||||
|
// see if password needs prompting
|
||||||
|
if (obj->data.mail->pass[0] == '*' && obj->data.mail->pass[1] == '\0') {
|
||||||
|
int fp = fileno(stdin);
|
||||||
|
struct termios term;
|
||||||
|
tcgetattr(fp, &term);
|
||||||
|
term.c_lflag &= ~ECHO;
|
||||||
|
tcsetattr(fp, TCSANOW, &term);
|
||||||
|
printf("Mailbox password (%s@%s): ", obj->data.mail->user, obj->data.mail->host);
|
||||||
|
scanf("%128s", obj->data.mail->pass);
|
||||||
|
printf("\n");
|
||||||
|
term.c_lflag |= ECHO;
|
||||||
|
tcsetattr(fp, TCSANOW, &term);
|
||||||
|
}
|
||||||
|
// now we check for optional args
|
||||||
|
tmp = strstr(arg, "-i ");
|
||||||
|
if (tmp) {
|
||||||
|
tmp += 3;
|
||||||
|
sscanf(tmp, "%f", &obj->data.mail->interval);
|
||||||
|
} else {
|
||||||
|
obj->data.mail->interval = 300; // 5 minutes
|
||||||
|
}
|
||||||
|
tmp = strstr(arg, "-p ");
|
||||||
|
if (tmp) {
|
||||||
|
tmp += 3;
|
||||||
|
sscanf(tmp, "%u", &obj->data.mail->port);
|
||||||
|
} else {
|
||||||
|
obj->data.mail->port = 143; // default imap port
|
||||||
|
}
|
||||||
|
tmp = strstr(arg, "-f ");
|
||||||
|
if (tmp) {
|
||||||
|
tmp += 3;
|
||||||
|
sscanf(tmp, "%s", obj->data.mail->folder);
|
||||||
|
} else {
|
||||||
|
strncpy(obj->data.mail->folder, "INBOX", 128); // default imap inbox
|
||||||
|
}
|
||||||
|
tmp = strstr(arg, "-e ");
|
||||||
|
if (tmp) {
|
||||||
|
tmp += 3;
|
||||||
|
int len = 1024;
|
||||||
|
if (tmp[0] == '\'') {
|
||||||
|
len = strstr(tmp+1, "'") - tmp - 1;
|
||||||
|
if (len > 1024) {
|
||||||
|
len = 1024;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
strncpy(obj->data.mail->command, tmp+1, len);
|
||||||
|
} else {
|
||||||
|
obj->data.mail->command[0] = '\0';
|
||||||
|
}
|
||||||
|
obj->data.mail->pos = -1;
|
||||||
|
obj->global_mode = 0;
|
||||||
|
} else {
|
||||||
|
obj->global_mode = 1;
|
||||||
|
}
|
||||||
|
END
|
||||||
|
OBJ(imap_messages, 0)
|
||||||
|
if (arg) {
|
||||||
|
// proccss
|
||||||
|
obj->data.mail = malloc(sizeof(struct mail_s));
|
||||||
|
char *tmp;
|
||||||
|
if (sscanf(arg, "%128s %128s %128s", obj->data.mail->host, obj->data.mail->user, obj->data.mail->pass) != 3) {
|
||||||
|
ERR("Scanning IMAP args failed");
|
||||||
|
}
|
||||||
|
// see if password needs prompting
|
||||||
|
if (obj->data.mail->pass[0] == '*' && obj->data.mail->pass[1] == '\0') {
|
||||||
|
int fp = fileno(stdin);
|
||||||
|
struct termios term;
|
||||||
|
tcgetattr(fp, &term);
|
||||||
|
term.c_lflag &= ~ECHO;
|
||||||
|
tcsetattr(fp, TCSANOW, &term);
|
||||||
|
printf("Mailbox password (%s@%s): ", obj->data.mail->user, obj->data.mail->host);
|
||||||
|
scanf("%128s", obj->data.mail->pass);
|
||||||
|
printf("\n");
|
||||||
|
term.c_lflag |= ECHO;
|
||||||
|
tcsetattr(fp, TCSANOW, &term);
|
||||||
|
}
|
||||||
|
// now we check for optional args
|
||||||
|
tmp = strstr(arg, "-i ");
|
||||||
|
if (tmp) {
|
||||||
|
tmp += 3;
|
||||||
|
sscanf(tmp, "%f", &obj->data.mail->interval);
|
||||||
|
} else {
|
||||||
|
obj->data.mail->interval = 300; // 5 minutes
|
||||||
|
}
|
||||||
|
tmp = strstr(arg, "-p ");
|
||||||
|
if (tmp) {
|
||||||
|
tmp += 3;
|
||||||
|
sscanf(tmp, "%u", &obj->data.mail->port);
|
||||||
|
} else {
|
||||||
|
obj->data.mail->port = 143; // default imap port
|
||||||
|
}
|
||||||
|
tmp = strstr(arg, "-f ");
|
||||||
|
if (tmp) {
|
||||||
|
tmp += 3;
|
||||||
|
sscanf(tmp, "%s", obj->data.mail->folder);
|
||||||
|
} else {
|
||||||
|
strncpy(obj->data.mail->folder, "INBOX", 128); // default imap inbox
|
||||||
|
}
|
||||||
|
tmp = strstr(arg, "-e ");
|
||||||
|
if (tmp) {
|
||||||
|
tmp += 3;
|
||||||
|
int len = 1024;
|
||||||
|
if (tmp[0] == '\'') {
|
||||||
|
len = strstr(tmp+1, "'") - tmp - 1;
|
||||||
|
if (len > 1024) {
|
||||||
|
len = 1024;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
strncpy(obj->data.mail->command, tmp+1, len);
|
||||||
|
} else {
|
||||||
|
obj->data.mail->command[0] = '\0';
|
||||||
|
}
|
||||||
|
obj->data.mail->pos = -1;
|
||||||
|
obj->global_mode = 0;
|
||||||
|
} else {
|
||||||
|
obj->global_mode = 1;
|
||||||
|
}
|
||||||
|
END
|
||||||
|
OBJ(pop3_unseen, 0)
|
||||||
|
if (arg) {
|
||||||
|
// proccss
|
||||||
|
obj->data.mail = malloc(sizeof(struct mail_s));
|
||||||
|
char *tmp;
|
||||||
|
if (sscanf(arg, "%128s %128s %128s", obj->data.mail->host, obj->data.mail->user, obj->data.mail->pass) != 3) {
|
||||||
|
ERR("Scanning POP3 args failed");
|
||||||
|
}
|
||||||
|
// see if password needs prompting
|
||||||
|
if (obj->data.mail->pass[0] == '*' && obj->data.mail->pass[1] == '\0') {
|
||||||
|
int fp = fileno(stdin);
|
||||||
|
struct termios term;
|
||||||
|
tcgetattr(fp, &term);
|
||||||
|
term.c_lflag &= ~ECHO;
|
||||||
|
tcsetattr(fp, TCSANOW, &term);
|
||||||
|
printf("Mailbox password (%s@%s): ", obj->data.mail->user, obj->data.mail->host);
|
||||||
|
scanf("%128s", obj->data.mail->pass);
|
||||||
|
printf("\n");
|
||||||
|
term.c_lflag |= ECHO;
|
||||||
|
tcsetattr(fp, TCSANOW, &term);
|
||||||
|
}
|
||||||
|
// now we check for optional args
|
||||||
|
tmp = strstr(arg, "-i ");
|
||||||
|
if (tmp) {
|
||||||
|
tmp += 3;
|
||||||
|
sscanf(tmp, "%f", &obj->data.mail->interval);
|
||||||
|
} else {
|
||||||
|
obj->data.mail->interval = 300; // 5 minutes
|
||||||
|
}
|
||||||
|
tmp = strstr(arg, "-p ");
|
||||||
|
if (tmp) {
|
||||||
|
tmp += 3;
|
||||||
|
sscanf(tmp, "%u", &obj->data.mail->port);
|
||||||
|
} else {
|
||||||
|
obj->data.mail->port = 110; // default pop3 port
|
||||||
|
}
|
||||||
|
tmp = strstr(arg, "-e ");
|
||||||
|
if (tmp) {
|
||||||
|
tmp += 3;
|
||||||
|
int len = 1024;
|
||||||
|
if (tmp[0] == '\'') {
|
||||||
|
len = strstr(tmp+1, "'") - tmp - 1;
|
||||||
|
if (len > 1024) {
|
||||||
|
len = 1024;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
strncpy(obj->data.mail->command, tmp+1, len);
|
||||||
|
} else {
|
||||||
|
obj->data.mail->command[0] = '\0';
|
||||||
|
}
|
||||||
|
obj->data.mail->pos = -1;
|
||||||
|
obj->global_mode = 0;
|
||||||
|
} else {
|
||||||
|
obj->global_mode = 1;
|
||||||
|
}
|
||||||
|
END
|
||||||
|
OBJ(pop3_used, 0)
|
||||||
|
if (arg) {
|
||||||
|
// proccss
|
||||||
|
obj->data.mail = malloc(sizeof(struct mail_s));
|
||||||
|
char *tmp;
|
||||||
|
if (sscanf(arg, "%128s %128s %128s", obj->data.mail->host, obj->data.mail->user, obj->data.mail->pass) != 3) {
|
||||||
|
ERR("Scanning POP3 args failed");
|
||||||
|
}
|
||||||
|
// see if password needs prompting
|
||||||
|
if (obj->data.mail->pass[0] == '*' && obj->data.mail->pass[1] == '\0') {
|
||||||
|
int fp = fileno(stdin);
|
||||||
|
struct termios term;
|
||||||
|
tcgetattr(fp, &term);
|
||||||
|
term.c_lflag &= ~ECHO;
|
||||||
|
tcsetattr(fp, TCSANOW, &term);
|
||||||
|
printf("Mailbox password (%s@%s): ", obj->data.mail->user, obj->data.mail->host);
|
||||||
|
scanf("%128s", obj->data.mail->pass);
|
||||||
|
printf("\n");
|
||||||
|
term.c_lflag |= ECHO;
|
||||||
|
tcsetattr(fp, TCSANOW, &term);
|
||||||
|
}
|
||||||
|
// now we check for optional args
|
||||||
|
tmp = strstr(arg, "-i ");
|
||||||
|
if (tmp) {
|
||||||
|
tmp += 3;
|
||||||
|
sscanf(tmp, "%f", &obj->data.mail->interval);
|
||||||
|
} else {
|
||||||
|
obj->data.mail->interval = 300; // 5 minutes
|
||||||
|
}
|
||||||
|
tmp = strstr(arg, "-p ");
|
||||||
|
if (tmp) {
|
||||||
|
tmp += 3;
|
||||||
|
sscanf(tmp, "%u", &obj->data.mail->port);
|
||||||
|
} else {
|
||||||
|
obj->data.mail->port = 110; // default pop3 port
|
||||||
|
}
|
||||||
|
tmp = strstr(arg, "-e ");
|
||||||
|
if (tmp) {
|
||||||
|
tmp += 3;
|
||||||
|
int len = 1024;
|
||||||
|
if (tmp[0] == '\'') {
|
||||||
|
len = strstr(tmp+1, "'") - tmp - 1;
|
||||||
|
if (len > 1024) {
|
||||||
|
len = 1024;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
strncpy(obj->data.mail->command, tmp+1, len);
|
||||||
|
} else {
|
||||||
|
obj->data.mail->command[0] = '\0';
|
||||||
|
}
|
||||||
|
obj->data.mail->pos = -1;
|
||||||
|
obj->global_mode = 0;
|
||||||
|
} else {
|
||||||
|
obj->global_mode = 1;
|
||||||
|
}
|
||||||
|
END
|
||||||
#ifdef MPD
|
#ifdef MPD
|
||||||
OBJ(mpd_artist, INFO_MPD)
|
OBJ(mpd_artist, INFO_MPD)
|
||||||
END OBJ(mpd_title, INFO_MPD)
|
END OBJ(mpd_title, INFO_MPD)
|
||||||
@ -2822,7 +3501,91 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object *
|
|||||||
}
|
}
|
||||||
snprintf(p, p_max_size, "%s", obj->data.execi.buffer);
|
snprintf(p, p_max_size, "%s", obj->data.execi.buffer);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* HAVE_POPEN */
|
||||||
|
OBJ(imap_unseen) {
|
||||||
|
if (obj->global_mode) { // this means we use info
|
||||||
|
if (info.mail->pos < 0) {
|
||||||
|
info.mail->last_update = current_update_time;
|
||||||
|
if (pthread_create(&(info.mail->thread_info.thread), NULL, (void*)imap_thread, (void*) info.mail)) {
|
||||||
|
ERR("Error starting thread");
|
||||||
|
}
|
||||||
|
info.mail->pos = register_thread(&(info.mail->thread_info));
|
||||||
|
}
|
||||||
|
snprintf(p, p_max_size, "%u", info.mail->unseen);
|
||||||
|
} else { // this means we use obj
|
||||||
|
if (obj->data.mail->pos < 0) {
|
||||||
|
obj->data.mail->last_update = current_update_time;
|
||||||
|
if (pthread_create(&(obj->data.mail->thread_info.thread), NULL, (void*)imap_thread, (void*) obj->data.mail)) {
|
||||||
|
ERR("Error starting thread");
|
||||||
|
}
|
||||||
|
obj->data.mail->pos = register_thread(&(obj->data.mail->thread_info));
|
||||||
|
}
|
||||||
|
snprintf(p, p_max_size, "%u", obj->data.mail->unseen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
OBJ(imap_messages) {
|
||||||
|
if (obj->global_mode) { // this means we use info
|
||||||
|
if (info.mail->pos < 0) {
|
||||||
|
info.mail->last_update = current_update_time;
|
||||||
|
if (pthread_create(&(info.mail->thread_info.thread), NULL, (void*)imap_thread, (void*) info.mail)) {
|
||||||
|
ERR("Error starting thread");
|
||||||
|
}
|
||||||
|
info.mail->pos = register_thread(&(info.mail->thread_info));
|
||||||
|
}
|
||||||
|
snprintf(p, p_max_size, "%u", info.mail->messages);
|
||||||
|
} else { // this means we use obj
|
||||||
|
if (obj->data.mail->pos < 0) {
|
||||||
|
obj->data.mail->last_update = current_update_time;
|
||||||
|
if (pthread_create(&(obj->data.mail->thread_info.thread), NULL, (void*)imap_thread, (void*) obj->data.mail)) {
|
||||||
|
ERR("Error starting thread");
|
||||||
|
}
|
||||||
|
obj->data.mail->pos = register_thread(&(obj->data.mail->thread_info));
|
||||||
|
}
|
||||||
|
snprintf(p, p_max_size, "%u", obj->data.mail->messages);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
OBJ(pop3_unseen) {
|
||||||
|
if (obj->global_mode) { // this means we use info
|
||||||
|
if (info.mail->pos < 0) {
|
||||||
|
info.mail->last_update = current_update_time;
|
||||||
|
if (pthread_create(&(info.mail->thread_info.thread), NULL, (void*)pop3_thread, (void*) info.mail)) {
|
||||||
|
ERR("Error starting thread");
|
||||||
|
}
|
||||||
|
info.mail->pos = register_thread(&(info.mail->thread_info));
|
||||||
|
}
|
||||||
|
snprintf(p, p_max_size, "%u", info.mail->unseen);
|
||||||
|
} else { // this means we use obj
|
||||||
|
if (obj->data.mail->pos < 0) {
|
||||||
|
obj->data.mail->last_update = current_update_time;
|
||||||
|
if (pthread_create(&(obj->data.mail->thread_info.thread), NULL, (void*)pop3_thread, (void*) obj->data.mail)) {
|
||||||
|
ERR("Error starting thread");
|
||||||
|
}
|
||||||
|
obj->data.mail->pos = register_thread(&(obj->data.mail->thread_info));
|
||||||
|
}
|
||||||
|
snprintf(p, p_max_size, "%u", obj->data.mail->unseen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
OBJ(pop3_used) {
|
||||||
|
if (obj->global_mode) { // this means we use info
|
||||||
|
if (info.mail->pos < 0) {
|
||||||
|
info.mail->last_update = current_update_time;
|
||||||
|
if (pthread_create(&(info.mail->thread_info.thread), NULL, (void*)pop3_thread, (void*) info.mail)) {
|
||||||
|
ERR("Error starting thread");
|
||||||
|
}
|
||||||
|
info.mail->pos = register_thread(&(info.mail->thread_info));
|
||||||
|
}
|
||||||
|
snprintf(p, p_max_size, "%.1f", info.mail->used/1024.0/1024.0);
|
||||||
|
} else { // this means we use obj
|
||||||
|
if (obj->data.mail->pos < 0) {
|
||||||
|
obj->data.mail->last_update = current_update_time;
|
||||||
|
if (pthread_create(&(obj->data.mail->thread_info.thread), NULL, (void*)pop3_thread, (void*) obj->data.mail)) {
|
||||||
|
ERR("Error starting thread");
|
||||||
|
}
|
||||||
|
obj->data.mail->pos = register_thread(&(obj->data.mail->thread_info));
|
||||||
|
}
|
||||||
|
snprintf(p, p_max_size, "%.1f", obj->data.mail->used/1024.0/1024.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
OBJ(fs_bar) {
|
OBJ(fs_bar) {
|
||||||
if (obj->data.fs != NULL) {
|
if (obj->data.fs != NULL) {
|
||||||
if (obj->data.fs->size == 0)
|
if (obj->data.fs->size == 0)
|
||||||
@ -5300,6 +6063,121 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, b) == 0)
|
|||||||
CONF_ERR;
|
CONF_ERR;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
CONF("imap") {
|
||||||
|
if (value) {
|
||||||
|
info.mail = malloc(sizeof(struct mail_s));
|
||||||
|
char *tmp;
|
||||||
|
if (sscanf(value, "%128s %128s %128s", info.mail->host, info.mail->user, info.mail->pass) != 3) {
|
||||||
|
ERR("Scanning IMAP args failed");
|
||||||
|
}
|
||||||
|
// see if password needs prompting
|
||||||
|
if (info.mail->pass[0] == '*' && info.mail->pass[1] == '\0') {
|
||||||
|
int fp = fileno(stdin);
|
||||||
|
struct termios term;
|
||||||
|
tcgetattr(fp, &term);
|
||||||
|
term.c_lflag &= ~ECHO;
|
||||||
|
tcsetattr(fp, TCSANOW, &term);
|
||||||
|
printf("Mailbox password (%s@%s): ", info.mail->user, info.mail->host);
|
||||||
|
scanf("%128s", info.mail->pass);
|
||||||
|
printf("\n");
|
||||||
|
term.c_lflag |= ECHO;
|
||||||
|
tcsetattr(fp, TCSANOW, &term);
|
||||||
|
}
|
||||||
|
// now we check for optional args
|
||||||
|
tmp = strstr(value, "-i ");
|
||||||
|
if (tmp) {
|
||||||
|
tmp += 3;
|
||||||
|
sscanf(tmp, "%f", &info.mail->interval);
|
||||||
|
} else {
|
||||||
|
info.mail->interval = 300; // 5 minutes
|
||||||
|
}
|
||||||
|
tmp = strstr(value, "-p ");
|
||||||
|
if (tmp) {
|
||||||
|
tmp += 3;
|
||||||
|
sscanf(tmp, "%u", &info.mail->port);
|
||||||
|
} else {
|
||||||
|
info.mail->port = 143; // default imap port
|
||||||
|
}
|
||||||
|
tmp = strstr(value, "-f ");
|
||||||
|
if (tmp) {
|
||||||
|
tmp += 3;
|
||||||
|
sscanf(tmp, "%s", info.mail->folder);
|
||||||
|
} else {
|
||||||
|
strncpy(info.mail->folder, "INBOX", 128); // default imap inbox
|
||||||
|
}
|
||||||
|
tmp = strstr(value, "-e ");
|
||||||
|
if (tmp) {
|
||||||
|
tmp += 3;
|
||||||
|
int len = 1024;
|
||||||
|
if (tmp[0] == '\'') {
|
||||||
|
len = strstr(tmp+1, "'") - tmp - 1;
|
||||||
|
if (len > 1024) {
|
||||||
|
len = 1024;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
strncpy(info.mail->command, tmp+1, len);
|
||||||
|
} else {
|
||||||
|
info.mail->command[0] = '\0';
|
||||||
|
}
|
||||||
|
info.mail->pos = -1;
|
||||||
|
} else {
|
||||||
|
CONF_ERR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CONF("pop3") {
|
||||||
|
if (value) {
|
||||||
|
info.mail = malloc(sizeof(struct mail_s));
|
||||||
|
char *tmp;
|
||||||
|
if (sscanf(value, "%128s %128s %128s", info.mail->host, info.mail->user, info.mail->pass) != 3) {
|
||||||
|
ERR("Scanning POP3 args failed");
|
||||||
|
}
|
||||||
|
// see if password needs prompting
|
||||||
|
if (info.mail->pass[0] == '*' && info.mail->pass[1] == '\0') {
|
||||||
|
int fp = fileno(stdin);
|
||||||
|
struct termios term;
|
||||||
|
tcgetattr(fp, &term);
|
||||||
|
term.c_lflag &= ~ECHO;
|
||||||
|
tcsetattr(fp, TCSANOW, &term);
|
||||||
|
printf("Mailbox password (%s@%s): ", info.mail->user, info.mail->host);
|
||||||
|
scanf("%128s", info.mail->pass);
|
||||||
|
printf("\n");
|
||||||
|
term.c_lflag |= ECHO;
|
||||||
|
tcsetattr(fp, TCSANOW, &term);
|
||||||
|
}
|
||||||
|
// now we check for optional args
|
||||||
|
tmp = strstr(value, "-i ");
|
||||||
|
if (tmp) {
|
||||||
|
tmp += 3;
|
||||||
|
sscanf(tmp, "%f", &info.mail->interval);
|
||||||
|
} else {
|
||||||
|
info.mail->interval = 300; // 5 minutes
|
||||||
|
}
|
||||||
|
tmp = strstr(value, "-p ");
|
||||||
|
if (tmp) {
|
||||||
|
tmp += 3;
|
||||||
|
sscanf(tmp, "%u", &info.mail->port);
|
||||||
|
} else {
|
||||||
|
info.mail->port = 110; // default pop3 port
|
||||||
|
}
|
||||||
|
tmp = strstr(value, "-e ");
|
||||||
|
if (tmp) {
|
||||||
|
tmp += 3;
|
||||||
|
int len = 1024;
|
||||||
|
if (tmp[0] == '\'') {
|
||||||
|
len = strstr(tmp+1, "'") - tmp - 1;
|
||||||
|
if (len > 1024) {
|
||||||
|
len = 1024;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
strncpy(info.mail->command, tmp+1, len);
|
||||||
|
} else {
|
||||||
|
info.mail->command[0] = '\0';
|
||||||
|
}
|
||||||
|
info.mail->pos = -1;
|
||||||
|
} else {
|
||||||
|
CONF_ERR;
|
||||||
|
}
|
||||||
|
}
|
||||||
#ifdef MPD
|
#ifdef MPD
|
||||||
CONF("mpd_host") {
|
CONF("mpd_host") {
|
||||||
if (value)
|
if (value)
|
||||||
|
23
src/conky.h
23
src/conky.h
@ -102,6 +102,27 @@ struct fs_stat {
|
|||||||
long long free;
|
long long free;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct thread_info_s {
|
||||||
|
pthread_t thread;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct mail_s { // for imap and pop3
|
||||||
|
unsigned int unseen;
|
||||||
|
unsigned int messages;
|
||||||
|
unsigned int used;
|
||||||
|
unsigned int quota;
|
||||||
|
unsigned int port;
|
||||||
|
float interval;
|
||||||
|
double last_update;
|
||||||
|
char host[128];
|
||||||
|
char user[128];
|
||||||
|
char pass[128];
|
||||||
|
char command[1024];
|
||||||
|
char folder[128];
|
||||||
|
int pos;
|
||||||
|
struct thread_info_s thread_info;
|
||||||
|
} mail;
|
||||||
|
|
||||||
/*struct cpu_stat {
|
/*struct cpu_stat {
|
||||||
unsigned int user, nice, system, idle, iowait, irq, softirq;
|
unsigned int user, nice, system, idle, iowait, irq, softirq;
|
||||||
int cpu_avg_samples;
|
int cpu_avg_samples;
|
||||||
@ -258,6 +279,8 @@ struct information {
|
|||||||
float loadavg[3];
|
float loadavg[3];
|
||||||
|
|
||||||
int new_mail_count, mail_count;
|
int new_mail_count, mail_count;
|
||||||
|
struct mail_s* mail;
|
||||||
|
int mail_running;
|
||||||
#ifdef SETI
|
#ifdef SETI
|
||||||
float seti_prog;
|
float seti_prog;
|
||||||
float seti_credit;
|
float seti_credit;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user