RSS was not really disabled when it was supposed to be. Experimental wireless support.
[monky] / src / conky.h
index 077d490..d941121 100644 (file)
@@ -9,7 +9,6 @@
 #ifndef _conky_h_
 #define _conky_h_
 
-#include <pthread.h>
 #if defined(HAS_MCHECK_H)
 #include <mcheck.h>
 #endif /* HAS_MCHECK_H */
@@ -17,6 +16,7 @@
 #include <sys/utsname.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <locale.h>
 #include <langinfo.h>
 #include <wchar.h>
 #include <kvm.h>
 #endif /* __FreeBSD__ */
 
-#ifdef X11
-#if defined(HAVE_CAIRO_H) && defined(HAVE_CAIRO_XLIB_H) && defined(WANT_CAIRO)
-#define CAIRO
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <cairo.h>
-#include <cairo-xlib.h>
-#endif
-#endif /* X11 */
-
 #if defined(__FreeBSD__) && (defined(i386) || defined(__i386__))
 #include <machine/apm_bios.h>
 #endif /* __FreeBSD__ */
 
-#if defined(XMMS) || defined(BMP) || defined(AUDACIOUS) || defined(INFOPIPE)
-#include "xmms.h"
+#if defined(__OpenBSD__)
+#include <sys/sysctl.h>
+#include <sys/sensors.h>
+#include <machine/apmvar.h>
+#endif /* __OpenBSD__ */
+
+#ifdef AUDACIOUS
+#include "audacious.h"
 #endif
 
+#ifdef XMMS2
+#include <xmmsclient/xmmsclient.h>
+#endif
+
+#ifdef RSS
+#include "prss.h"
+#endif
+
+#include "mboxscan.h"
+#include "timed_thread.h"
+
 #define TOP_CPU 1
 #define TOP_NAME 2
 #define TOP_PID 3
 
 #define TEXT_BUFFER_SIZE 1280
 #define P_MAX_SIZE ((TEXT_BUFFER_SIZE * 4) - 2) 
+extern unsigned int text_buffer_size;
+
+/* maximum number of special things, e.g. fonts, offsets, aligns, etc. */
+#define MAX_SPECIALS_DEFAULT 512
+
+/* maximum size of config TEXT buffer, i.e. below TEXT line. */
+#define MAX_USER_TEXT_DEFAULT 16384
 
 #include <sys/socket.h>
 
@@ -87,9 +101,18 @@ struct net_stat {
        struct sockaddr addr;
        int linkstatus;
        double net_rec[15], net_trans[15];
+       // wireless extensions
+       char essid[32];
+       char bitrate[16];
+       char mode[16];
+       char ap[18];
+       int link_qual;
+       int link_qual_max;
 };
 
 unsigned int diskio_value;
+unsigned int diskio_read_value;
+unsigned int diskio_write_value;
 
 struct fs_stat {
        char *path;
@@ -98,6 +121,23 @@ struct fs_stat {
        long long free;
 };
 
+struct mail_s {                        // for imap and pop3
+       unsigned long unseen;
+       unsigned long messages;
+       unsigned long used;
+       unsigned long quota;
+       unsigned long port;
+       float interval;
+       double last_update;
+       char host[128];
+       char user[128];
+       char pass[128];
+       char command[1024];
+       char folder[128];
+       char secure;
+       timed_thread *p_timed_thread;
+} mail;
+
 /*struct cpu_stat {
        unsigned int user, nice, system, idle, iowait, irq, softirq;
        int cpu_avg_samples;
@@ -122,19 +162,38 @@ struct mpd_s {
        int bitrate;
        int length;
        int elapsed;
+       int max_title_len;              /* e.g. ${mpd_title 50} */
+};
+#endif
+
+#ifdef XMMS2
+struct xmms2_s {
+    char* artist;
+    char* album;
+    char* title;
+    char* genre;
+    char* comment;
+    char* decoder;
+    char* transport;
+    char* url;
+    char* date;
+    int tracknr;
+    int bitrate;
+    unsigned int id;
+    int duration;
+    int elapsed;
+    float size;
+
+    float progress;
+    char* status;
 };
 #endif
 
-#if defined(XMMS) || defined(BMP) || defined(AUDACIOUS) || defined(INFOPIPE)
-struct xmms_s {
-       unsigned int project_mask;
-       unsigned int current_project;
-       xmms_t items;                   /* e.g. items[XMMS_STATUS] yields char[] */
-       int runnable;                   /* used to signal worker thread to stop */
-       pthread_t thread;               /* worker thread for xmms updating */
-       pthread_attr_t thread_attr;     /* thread attributes */
-       pthread_mutex_t item_mutex;     /* mutex for item array */
-       pthread_mutex_t runnable_mutex; /* mutex for runnable flag */
+#ifdef AUDACIOUS
+struct audacious_s {
+       audacious_t items;              /* e.g. items[AUDACIOUS_STATUS] */
+       int max_title_len;              /* e.g. ${audacious_title 50} */
+       timed_thread *p_timed_thread;
 };
 #endif
 
@@ -150,10 +209,15 @@ struct bmpx_s {
 };
 #endif
 
+void update_entropy();
+struct entropy_s {
+       unsigned int entropy_avail;
+       unsigned int poolsize;
+};
+
 #ifdef TCP_PORT_MONITOR
 #include "libtcp-portmon.h"
-#define MIN_PORT_MONITORS_DEFAULT 16
-#define MIN_PORT_MONITOR_CONNECTIONS_DEFAULT 256
+#define MAX_PORT_MONITOR_CONNECTIONS_DEFAULT 256
 #endif
 
 enum {
@@ -161,45 +225,55 @@ enum {
        INFO_MAIL = 1,
        INFO_MEM = 2,
        INFO_NET = 3,
-#ifdef SETI
-       INFO_SETI = 4,
-#endif
-       INFO_PROCS = 5,
-       INFO_RUN_PROCS = 6,
-       INFO_UPTIME = 7,
-       INFO_BUFFERS = 8,
-       INFO_FS = 9,
-       INFO_I2C = 10,
-       INFO_MIXER = 11,
-       INFO_LOADAVG = 12,
-       INFO_UNAME = 13,
-       INFO_FREQ = 14,
+       INFO_PROCS = 4,
+       INFO_RUN_PROCS = 5,
+       INFO_UPTIME = 6,
+       INFO_BUFFERS = 7,
+       INFO_FS = 8,
+       INFO_I2C = 9,
+       INFO_MIXER = 10,
+       INFO_LOADAVG = 11,
+       INFO_UNAME = 12,
+       INFO_FREQ = 13,
 #ifdef MPD
-       INFO_MPD = 15,
-#endif
-       INFO_TOP = 16,
-#ifdef MLDONKEY
-       INFO_MLDONKEY = 18,
+       INFO_MPD = 14,
 #endif
-       INFO_WIFI = 19,
-       INFO_DISKIO = 20,
-       INFO_I8K = 21,
+       INFO_TOP = 15,
+       INFO_WIFI = 16,
+       INFO_DISKIO = 17,
+       INFO_I8K = 18,
 #ifdef TCP_PORT_MONITOR
-        INFO_TCP_PORT_MONITOR = 22,
+        INFO_TCP_PORT_MONITOR = 19,
 #endif
-#if defined(XMMS) || defined(BMP) || defined(AUDACIOUS) || defined(INFOPIPE)
-       INFO_XMMS = 23,
+#ifdef AUDACIOUS
+       INFO_AUDACIOUS = 20,
 #endif
 #ifdef BMPX
-       INFO_BMPX = 24,
+       INFO_BMPX = 21,
+#endif
+#ifdef XMMS2
+       INFO_XMMS2 = 22,
+#endif
+       INFO_ENTROPY = 23,
+#ifdef RSS
+       INFO_RSS = 24,
 #endif
 };
 
 
+/* get_battery_stuff() item selector */
+enum {
+       BATTERY_STATUS,
+       BATTERY_TIME
+};
+
 #ifdef MPD
 #include "libmpdclient.h"
 #endif
 
+/* Update interval */
+double update_interval;
+
 volatile int g_signal_pending;
 
 struct information {
@@ -212,8 +286,8 @@ struct information {
        double uptime;
 
        /* memory information in kilobytes */
-       unsigned long mem, memmax, swap, swapmax;
-       unsigned long bufmem, buffers, cached;
+       unsigned long long mem, memmax, swap, swapmax;
+       unsigned long long bufmem, buffers, cached;
 
        unsigned short procs;
        unsigned short run_procs;
@@ -228,16 +302,21 @@ struct information {
        float loadavg[3];
 
        int new_mail_count, mail_count;
-#ifdef SETI
-       float seti_prog;
-       float seti_credit;
-#endif
+       struct mail_s* mail;
+       int mail_running;
 #ifdef MPD
        struct mpd_s mpd;
        mpd_Connection *conn;
 #endif
-#if defined(XMMS) || defined(BMP) || defined(AUDACIOUS) || defined(INFOPIPE)
-       struct xmms_s xmms;
+#ifdef XMMS2
+       struct xmms2_s xmms2;
+       int xmms2_conn_state;
+       xmms_socket_t xmms2_fd; 
+       fd_set xmms2_fdset;
+       xmmsc_connection_t *xmms2_conn;
+#endif
+#ifdef AUDACIOUS
+       struct audacious_s audacious;
 #endif
 #ifdef BMPX
        struct bmpx_s bmpx;
@@ -247,9 +326,10 @@ struct information {
        struct process *first_process;
        unsigned long looped;
 #ifdef TCP_PORT_MONITOR
-        tcp_port_monitor_collection_t * p_tcp_port_monitor_collection;
+  tcp_port_monitor_collection_t * p_tcp_port_monitor_collection;
 #endif
        short kflags;  /* kernel settings, see enum KFLAG */
+       struct entropy_s entropy;
 };
 
 enum {
@@ -285,8 +365,7 @@ char tmpstring2[TEXT_BUFFER_SIZE];
 #include <X11/Xft/Xft.h>
 #endif
 
-#if defined(HAVE_XDBE) && defined(DOUBLE_BUFFER)
-#define XDBE
+#ifdef HAVE_XDBE
 #include <X11/extensions/Xdbe.h>
 #endif
 
@@ -314,7 +393,7 @@ struct conky_window {
        Window root,window,desktop;
        Drawable drawable;
        GC gc;
-#ifdef XDBE
+#ifdef HAVE_XDBE
        XdbeBackBuffer back_buffer;
 #endif
 #ifdef XFT
@@ -324,7 +403,8 @@ struct conky_window {
        int width;
        int height;
 #ifdef OWN_WINDOW
-       char wm_class_name[256];
+       char class_name[256];
+  char title[256];
        int x;
        int y;
        unsigned int type;
@@ -332,7 +412,7 @@ struct conky_window {
 #endif
 };
 
-#ifdef XDBE
+#ifdef HAVE_XDBE
 extern int use_xdbe;
 #endif
 
@@ -351,8 +431,8 @@ extern int workarea[4];
 extern struct conky_window window;
 
 void init_X11();
-void init_window(int use_own_window, int width, int height, int set_trans, int back_colour, char * nodename,
-                char **argv, int argc);
+void init_window(int use_own_window, int width, int height, int set_trans, int back_colour, 
+                 char **argv, int argc);
 void create_gc();
 void set_transparent_background(Window win);
 long get_x11_color(const char *);
@@ -375,6 +455,7 @@ void variable_substitute(const char *s, char *dest, unsigned int n);
 void format_seconds(char *buf, unsigned int n, long t);
 void format_seconds_short(char *buf, unsigned int n, long t);
 struct net_stat *get_net_stat(const char *dev);
+void clear_net_stats(void);
 
 void update_stuff();
 
@@ -389,32 +470,68 @@ extern int no_buffers;
 
 /* system dependant (in linux.c) */
 
+int check_mount(char *s);
 void update_diskio(void);
 void prepare_update(void);
 void update_uptime(void);
 void update_meminfo(void);
 void update_net_stats(void);
+#if 0
 void update_wifi_stats(void);
+#endif
 void update_cpu_usage(void);
 void update_total_processes(void);
 void update_running_processes(void);
 void update_i8k(void);
-void get_freq( char *, size_t, char *, int ); /* pk */
-void get_freq_dynamic( char *, size_t, char *, int ); /* pk */
+char get_freq( char *, size_t, char *, int, unsigned int ); 
+void get_freq_dynamic( char *, size_t, char *, int ); 
+char get_voltage(char *, size_t, char *, int, unsigned int ); /* ptarjan */
 void update_load_average();
 int open_i2c_sensor(const char *dev, const char *type, int n, int *div,
                    char *devtype);
 double get_i2c_info(int *fd, int arg, char *devtype, char *type);
 
-void get_adt746x_cpu( char *, size_t ); /* pk */
-void get_adt746x_fan( char *, size_t ); /* pk */
+void get_adt746x_cpu( char *, size_t ); 
+void get_adt746x_fan( char *, size_t ); 
 unsigned int get_diskio(void);
 
 int open_acpi_temperature(const char *name);
 double get_acpi_temperature(int fd);
-void get_acpi_ac_adapter( char *, size_t ); /* pk */
-void get_acpi_fan( char *, size_t ); /* pk */
-void get_battery_stuff(char *buf, unsigned int n, const char *bat);
+void get_acpi_ac_adapter( char *, size_t ); 
+void get_acpi_fan( char *, size_t ); 
+void get_battery_stuff(char *buf, unsigned int n, const char *bat, int item);
+int get_battery_perct(const char *bat);
+int get_battery_perct_bar(const char *bat);
+void get_ibm_acpi_fan(char *buf, size_t client_buffer_size);
+void get_ibm_acpi_temps(void);
+void get_ibm_acpi_volume(char *buf, size_t client_buffer_size);
+void get_ibm_acpi_brightness(char *buf, size_t client_buffer_size);
+void get_cpu_count();
+
+struct ibm_acpi_struct {
+    unsigned int temps[8];
+};
+
+struct ibm_acpi_struct ibm_acpi;
+
+#if defined(__OpenBSD__)
+void update_obsd_sensors(void);
+void get_obsd_vendor(char *buf, size_t client_buffer_size);
+void get_obsd_product(char *buf, size_t client_buffer_size);
+
+#define OBSD_MAX_SENSORS 256
+struct obsd_sensors_struct {
+       int device;
+       float temp[MAXSENSORDEVICES][OBSD_MAX_SENSORS];
+       unsigned int fan[MAXSENSORDEVICES][OBSD_MAX_SENSORS];
+       float volt[MAXSENSORDEVICES][OBSD_MAX_SENSORS];
+};
+struct obsd_sensors_struct obsd_sensors;
+#endif /* __OpenBSD__ */
+
+
+enum { PB_BATT_STATUS, PB_BATT_PERCENT, PB_BATT_TIME};
+void get_powerbook_batt_info(char*, size_t, int);
 
 struct process {
        struct process *next;
@@ -459,70 +576,50 @@ extern char *current_mail_spool;
 
 void update_mail_count();
 
-/* in seti.c */
-
-#ifdef SETI
-extern char *seti_dir;
-
-void update_seti();
-#endif
-
 /* in freebsd.c */
 #if defined(__FreeBSD__)
 kvm_t *kd;
 #endif
 
-#if defined(__FreeBSD__) && (defined(i386) || defined(__i386__))
+#if (defined(__FreeBSD__) || defined(__OpenBSD__)) && (defined(i386) || defined(__i386__))
+#ifdef __OpenBSD__
+typedef struct apm_power_info *apm_info_t;
+#endif
 int apm_getinfo(int fd, apm_info_t aip);
 char *get_apm_adapter(void);
 char *get_apm_battery_life(void);
 char *get_apm_battery_time(void);
 #endif
-/* in mpd.c */
 
+/* in mpd.c */
 #ifdef MPD
 void update_mpd();
 #endif
 
-#ifdef MLDONKEY
-/* in mldonkey.c */
-typedef long long int64;
-/* The info necessary to connect to mldonkey. login and password can be NULL. */
-typedef struct mldonkey_config {
-       char *mldonkey_hostname;
-       int mldonkey_port;
-       char *mldonkey_login;
-       char *mldonkey_password;
-} mldonkey_config;
-
-/* The MLDonkey status returned */
-typedef struct mldonkey_info {
-       int64 upload_counter;
-       int64 download_counter;
-       int nshared_files;
-       int64 shared_counter;
-       int tcp_upload_rate;
-       int tcp_download_rate;
-       int udp_upload_rate;
-       int udp_download_rate;
-       int ndownloaded_files;
-       int ndownloading_files;
-       int nconnected_networks;
-       int connected_networks[1];
-} mldonkey_info;
-
-extern mldonkey_info mlinfo;
-extern mldonkey_config mlconfig;
-
-int get_mldonkey_status(mldonkey_config * config, mldonkey_info * info);
+/* in xmms2.c */
+#ifdef XMMS2
+void update_xmms2();
 #endif
 
-/* in linux.c */
+/* in hddtemp.c */
+#ifdef HDDTEMP
+int scan_hddtemp(const char *arg, char **dev, char **addr, int *port);
+char *get_hddtemp_info(char *dev, char *addr, int port, char *unit);
+#endif /* HDDTEMP */
 
-/* nothing to see here */
+/* in rss.c */
+#ifdef RSS
+PRSS* get_rss_info(char *uri, int delay);
+void init_rss_info();
+void free_rss_info();
+#endif /* RSS */
 
-/* in cairo.c */
+#if defined(__linux__)
+extern int post_21_kernel;
+#endif /* __linux__ */
 
-extern int do_it(void);
+/* in linux.c */
 
 #endif
+
+