mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-24 11:55:43 +00:00
removed all mldonkey and seti code -- totally broken
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@727 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
98ddc3d84c
commit
15fd6d6586
@ -1,10 +1,13 @@
|
||||
# $Id$
|
||||
|
||||
2006-11-04 pkovacs
|
||||
* Removed broken mldonkey and seti support.
|
||||
|
||||
2006-11-03 pkovacs
|
||||
* Removed direct support for Xmms, BMP and Infopipe from conky.
|
||||
* Removed support for Xmms, BMP and Infopipe from conky.
|
||||
The Xmms and Bmp players are projects are dead and distros such
|
||||
as Gentoo are slating them for removal.
|
||||
* Added direct support for Audacious with conventional linking.
|
||||
* Added support for Audacious with conventional linking.
|
||||
|
||||
2006-10-18
|
||||
* Implement WiFi signal level detection on FreeBSD (patch
|
||||
|
35
README
35
README
@ -44,10 +44,9 @@ COMPILING
|
||||
./configure --prefix=/usr --mandir=/usr/share/man --in-
|
||||
fodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --local-
|
||||
statedir=/var/lib --enable-xft --enable-own-window --enable-proc-uptime
|
||||
--enable-audacious --enable-bmpx --enable-seti --enable-hddtemp --en-
|
||||
able-mpd --enable-xmms2 --enable-imlib2 --enable-portmon --enable-ml-
|
||||
donkey --enable-debug --enable-double-buffer --enable-xdamage --en-
|
||||
able-x11
|
||||
--enable-audacious --enable-bmpx --enable-hddtemp --enable-mpd --en-
|
||||
able-xmms2 --enable-imlib2 --enable-portmon --enable-debug --en-
|
||||
able-double-buffer --enable-xdamage --enable-x11
|
||||
|
||||
make
|
||||
|
||||
@ -247,22 +246,6 @@ CONFIGURATION SETTINGS
|
||||
(if 0 or not set, default is 256)
|
||||
|
||||
|
||||
mldonkey_hostname
|
||||
Hostname for mldonkey stuff, defaults to localhost
|
||||
|
||||
|
||||
mldonkey_port
|
||||
Mldonkey port, 4001 default
|
||||
|
||||
|
||||
mldonkey_login
|
||||
Mldonkey login, default none
|
||||
|
||||
|
||||
mldonkey_password
|
||||
Mldonkey password, default none
|
||||
|
||||
|
||||
mpd_host
|
||||
Host of MPD server
|
||||
|
||||
@ -1109,18 +1092,6 @@ VARIABLES
|
||||
Uptime in a shorter format
|
||||
|
||||
|
||||
seti_prog
|
||||
Seti@home current progress
|
||||
|
||||
|
||||
seti_progbar (height),(width)
|
||||
Seti@home current progress bar
|
||||
|
||||
|
||||
seti_credit
|
||||
Seti@home total user credit
|
||||
|
||||
|
||||
voffset (pixels)
|
||||
Change vertical offset by N pixels. Negative values will cause
|
||||
text to overlap. See also $offset.
|
||||
|
@ -11,7 +11,7 @@ SRC_URI="mirror://sourceforge/conky/${P}.tar.bz2"
|
||||
LICENSE="BSD"
|
||||
SLOT="0"
|
||||
KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~sparc ~x86"
|
||||
IUSE="truetype X ipv6 bmpx bmp xmms xmms2 infopipe audacious"
|
||||
IUSE="truetype X ipv6 audacious bmpx"
|
||||
|
||||
DEPEND_COMMON="
|
||||
virtual/libc
|
||||
@ -21,16 +21,16 @@ DEPEND_COMMON="
|
||||
x11-libs/libX11
|
||||
x11-libs/libSM
|
||||
x11-libs/libXrender
|
||||
x11-libs/libXdamage
|
||||
x11-libs/libXft
|
||||
)
|
||||
virtual/x11
|
||||
)
|
||||
truetype? ( >=media-libs/freetype-2 )
|
||||
audacious? ( >=media-sound/audacious-0.1 )
|
||||
bmpx? ( media-sound/bmpx
|
||||
>=sys-apps/dbus-0.35
|
||||
)
|
||||
audacious? ( >=media-sound/audacious-0.1 )
|
||||
xmms2? ( medis-sound/xmms2 )
|
||||
)"
|
||||
|
||||
RDEPEND="${DEPEND_COMMON}"
|
||||
@ -62,14 +62,13 @@ src_compile() {
|
||||
fi
|
||||
local myconf
|
||||
myconf="--enable-double-buffer --enable-own-window --enable-proc-uptime \
|
||||
--enable-mpd --enable-mldonkey"
|
||||
--enable-mpd"
|
||||
econf \
|
||||
${myconf} \
|
||||
$(use_enable truetype xft) \
|
||||
$(use_enable X x11) \
|
||||
$(use_enable bmpx) \
|
||||
$(use_enable xmms2) \
|
||||
$(use_enable audacious) \
|
||||
$(use_enable bmpx) \
|
||||
$(use_enable !ipv6 portmon) || die "econf failed"
|
||||
emake ${mymake} || die "compile failed"
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ HOMEPAGE="http://conky.sf.net"
|
||||
LICENSE="BSD"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86 ~alpha"
|
||||
IUSE="truetype X ipv6 bmpx bmp xmms infopipe audacious"
|
||||
IUSE="truetype X ipv6 audacious bmpx"
|
||||
|
||||
DEPEND_COMMON="
|
||||
virtual/libc
|
||||
@ -27,13 +27,10 @@ DEPEND_COMMON="
|
||||
virtual/x11
|
||||
)
|
||||
truetype? ( >=media-libs/freetype-2 )
|
||||
audacious? ( >=media-sound/audacious-0.1 )
|
||||
bmpx? ( media-sound/bmpx
|
||||
>=sys-apps/dbus-0.35
|
||||
)
|
||||
bmp? ( media-sound/beep-media-player )
|
||||
audacious? ( media-sound/audacious )
|
||||
infopipe? ( || ( media-plugins/xmms-infopipe media-plugins/bmp-infopipe ) )
|
||||
xmms? ( media-sound/xmms )
|
||||
)"
|
||||
|
||||
RDEPEND="${DEPEND_COMMON}"
|
||||
@ -69,16 +66,13 @@ src_compile() {
|
||||
fi
|
||||
local myconf
|
||||
myconf="--enable-double-buffer --enable-own-window --enable-proc-uptime \
|
||||
--enable-mpd --enable-mldonkey"
|
||||
--enable-mpd"
|
||||
econf \
|
||||
${myconf} \
|
||||
$(use_enable truetype xft) \
|
||||
$(use_enable X x11) \
|
||||
$(use_enable bmpx) \
|
||||
$(use_enable bmp) \
|
||||
$(use_enable xmms) \
|
||||
$(use_enable audacious) \
|
||||
$(use_enable infopipe) \
|
||||
$(use_enable bmpx) \
|
||||
$(use_enable !ipv6 portmon) || die "econf failed"
|
||||
emake ${mymake} || die "compile failed"
|
||||
}
|
||||
|
29
configure.ac
29
configure.ac
@ -151,18 +151,6 @@ if test x$want_bmpx = xyes; then
|
||||
AC_DEFINE(BMPX, 1, [Define if you want BMPx support])
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Seti@Home
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE([seti],
|
||||
AC_HELP_STRING([--enable-seti], [enable if you want SETI at Home stats [[default=yes]]]),
|
||||
[want_seti="$enableval"], [want_seti=yes])
|
||||
|
||||
AM_CONDITIONAL(BUILD_SETI, test x$want_seti = xyes)
|
||||
if test x$want_seti = xyes; then
|
||||
AC_DEFINE(SETI, 1, [Define if you want SETI at Home stats])
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Hddtemp
|
||||
@ -242,18 +230,6 @@ dnl
|
||||
dnl Cairo
|
||||
dnl
|
||||
|
||||
dnl
|
||||
dnl MLDonkey
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE([mldonkey],
|
||||
AC_HELP_STRING([--enable-mldonkey], [enable if you want MLDonkey support [[default=no]]]),
|
||||
[want_mldonkey="$enableval"], [want_mldonkey=no])
|
||||
|
||||
AM_CONDITIONAL(BUILD_MLDONKEY, test x$want_mldonkey = xyes)
|
||||
if test x$want_mldonkey = xyes; then
|
||||
AC_DEFINE(MLDONKEY, 1, [Define if you want MLDonkey support])
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl ICONV
|
||||
@ -500,12 +476,11 @@ $PACKAGE $VERSION configured successfully:
|
||||
* music detection:
|
||||
audacious: $want_audacious
|
||||
bmpx: $want_bmpx
|
||||
xmms2: $want_xmms2
|
||||
mpd: $want_mpd
|
||||
xmms2: $want_xmms2
|
||||
|
||||
* general:
|
||||
hddtemp: $want_hddtemp
|
||||
portmon: $want_portmon
|
||||
mldonkey: $want_mldonkey
|
||||
hddtemp: $want_hddtemp
|
||||
|
||||
EOF
|
||||
|
@ -171,34 +171,6 @@
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command><option>mldonkey_hostname</option></command></term>
|
||||
<listitem>
|
||||
Hostname for mldonkey stuff, defaults to localhost
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command><option>mldonkey_port</option></command></term>
|
||||
<listitem>
|
||||
Mldonkey port, 4001 default
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command><option>mldonkey_login</option></command></term>
|
||||
<listitem>
|
||||
Mldonkey login, default none
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command><option>mldonkey_password</option></command></term>
|
||||
<listitem>
|
||||
Mldonkey password, default none
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command><option>mpd_host</option></command></term>
|
||||
<listitem>
|
||||
|
30
doc/conky.1
30
doc/conky.1
@ -44,7 +44,7 @@ Example to compile and run Conky with all optional components (note that some co
|
||||
.TP
|
||||
\fB\*(T<\fBsh autogen.sh\fR\*(T>\fR \*(T<\fB# Only required if building from Svn\fR\*(T>
|
||||
.TP
|
||||
\fB\*(T<\fB\&./configure \fR\*(T>\fR\*(T<\fB\-\-prefix=/usr \-\-mandir=/usr/share/man \-\-infodir=/usr/share/info \-\-datadir=/usr/share \-\-sysconfdir=/etc \-\-localstatedir=/var/lib \-\-enable\-xft \-\-enable\-own\-window \-\-enable\-proc\-uptime \-\-enable\-audacious \-\-enable\-bmpx \-\-enable\-seti \-\-enable\-hddtemp \-\-enable\-mpd \-\-enable\-xmms2 \-\-enable\-imlib2 \-\-enable\-portmon \-\-enable\-mldonkey \-\-enable\-debug \-\-enable\-double\-buffer \-\-enable\-xdamage \-\-enable\-x11\fR\*(T>
|
||||
\fB\*(T<\fB\&./configure \fR\*(T>\fR\*(T<\fB\-\-prefix=/usr \-\-mandir=/usr/share/man \-\-infodir=/usr/share/info \-\-datadir=/usr/share \-\-sysconfdir=/etc \-\-localstatedir=/var/lib \-\-enable\-xft \-\-enable\-own\-window \-\-enable\-proc\-uptime \-\-enable\-audacious \-\-enable\-bmpx \-\-enable\-hddtemp \-\-enable\-mpd \-\-enable\-xmms2 \-\-enable\-imlib2 \-\-enable\-portmon \-\-enable\-debug \-\-enable\-double\-buffer \-\-enable\-xdamage \-\-enable\-x11\fR\*(T>
|
||||
.TP
|
||||
\fB\*(T<\fBmake\fR\*(T>\fR
|
||||
.TP
|
||||
@ -231,22 +231,6 @@ Allow for the creation of at least this number of port monitors (if 0 or not set
|
||||
\fB\*(T<\fBmin_port_monitor_connections\fR\*(T>\fR
|
||||
Allow each port monitor to track at least this many connections (if 0 or not set, default is 256)
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBmldonkey_hostname\fR\*(T>\fR
|
||||
Hostname for mldonkey stuff, defaults to localhost
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBmldonkey_port\fR\*(T>\fR
|
||||
Mldonkey port, 4001 default
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBmldonkey_login\fR\*(T>\fR
|
||||
Mldonkey login, default none
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBmldonkey_password\fR\*(T>\fR
|
||||
Mldonkey password, default none
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBmpd_host\fR\*(T>\fR
|
||||
Host of MPD server
|
||||
@ -1006,18 +990,6 @@ Uptime
|
||||
\fB\*(T<\fBuptime_short\fR\*(T>\fR
|
||||
Uptime in a shorter format
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBseti_prog\fR\*(T>\fR
|
||||
Seti@home current progress
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBseti_progbar\fR\*(T>\fR \*(T<\fB(height),(width)\fR\*(T>
|
||||
Seti@home current progress bar
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBseti_credit\fR\*(T>\fR
|
||||
Seti@home total user credit
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBvoffset\fR\*(T>\fR \*(T<\fB(pixels)\fR\*(T>
|
||||
Change vertical offset by N pixels. Negative values will cause text to overlap. See also $offset.
|
||||
|
@ -79,7 +79,7 @@
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>./configure </option></command><option>--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --enable-xft --enable-own-window --enable-proc-uptime --enable-audacious --enable-bmpx --enable-seti --enable-hddtemp --enable-mpd --enable-xmms2 --enable-imlib2 --enable-portmon --enable-mldonkey --enable-debug --enable-double-buffer --enable-xdamage --enable-x11</option>
|
||||
<command><option>./configure </option></command><option>--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --enable-xft --enable-own-window --enable-proc-uptime --enable-audacious --enable-bmpx --enable-hddtemp --enable-mpd --enable-xmms2 --enable-imlib2 --enable-portmon --enable-debug --enable-double-buffer --enable-xdamage --enable-x11</option>
|
||||
</term>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
|
@ -1461,34 +1461,6 @@
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>seti_prog</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Seti@home current progress
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>seti_progbar</option></command>
|
||||
<option>(height),(width)</option>
|
||||
</term>
|
||||
<listitem>
|
||||
Seti@home current progress bar
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>seti_credit</option></command>
|
||||
</term>
|
||||
<listitem>
|
||||
Seti@home total user credit
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>voffset</option></command>
|
||||
|
@ -8,10 +8,6 @@ if BUILD_BMPX
|
||||
bmpx = bmpx.c
|
||||
endif
|
||||
|
||||
if BUILD_SETI
|
||||
seti = seti.c
|
||||
endif
|
||||
|
||||
if BUILD_MPD
|
||||
mpd = mpd.c libmpdclient.c
|
||||
endif
|
||||
@ -42,10 +38,6 @@ if BUILD_PORT_MONITORS
|
||||
port_monitors = libtcp-portmon.h libtcp-portmon.c hash.h hash.c
|
||||
endif
|
||||
|
||||
if BUILD_MLDONKEY
|
||||
mldonkey = mldonkey.c
|
||||
endif
|
||||
|
||||
if BUILD_X11
|
||||
x11 = x11.c
|
||||
endif
|
||||
@ -66,11 +58,9 @@ conky_SOURCES = \
|
||||
$(linux) \
|
||||
mail.c \
|
||||
mixer.c \
|
||||
$(mldonkey) \
|
||||
$(mpd) \
|
||||
$(netbsd) \
|
||||
$(port_monitors) \
|
||||
$(seti) \
|
||||
$(solaris) \
|
||||
remotec.c \
|
||||
remotec.h \
|
||||
@ -96,10 +86,8 @@ EXTRA_DIST = \
|
||||
libmpdclient.h \
|
||||
libtcp-portmon.c \
|
||||
libtcp-portmon.h \
|
||||
mldonkey.c \
|
||||
mpd.c \
|
||||
netbsd.c \
|
||||
seti.c \
|
||||
solaris.c \
|
||||
top.h \
|
||||
x11.c \
|
||||
|
10
src/common.c
10
src/common.c
@ -212,16 +212,6 @@ void update_stuff()
|
||||
update_i8k();
|
||||
#endif /* __linux__ */
|
||||
|
||||
#ifdef MLDONKEY
|
||||
if (NEED(INFO_MLDONKEY))
|
||||
get_mldonkey_status(&mlconfig, &mlinfo);
|
||||
#endif
|
||||
|
||||
#ifdef SETI
|
||||
if (NEED(INFO_SETI))
|
||||
update_seti();
|
||||
#endif
|
||||
|
||||
#ifdef MPD
|
||||
if (NEED(INFO_MPD))
|
||||
update_mpd();
|
||||
|
190
src/conky.c
190
src/conky.c
@ -76,25 +76,19 @@ static void print_version()
|
||||
#ifdef BMPX
|
||||
" * bmpx\n"
|
||||
#endif /* BMPX */
|
||||
#ifdef XMMS2
|
||||
" * xmms2\n"
|
||||
#endif /* XMMS2 */
|
||||
#ifdef MPD
|
||||
" * mpd\n"
|
||||
#endif /* MPD */
|
||||
#ifdef XMMS2
|
||||
" * xmms2\n"
|
||||
#endif /* XMMS2 */
|
||||
"\n General features:\n"
|
||||
#ifdef HDDTEMP
|
||||
" * hddtemp\n"
|
||||
#endif /* HDDTEMP */
|
||||
#ifdef TCP_PORT_MONITOR
|
||||
" * portmon\n"
|
||||
#endif /* TCP_PORT_MONITOR */
|
||||
#ifdef MLDONKEY
|
||||
" * mldonkey\n"
|
||||
#endif /* MLDONKEY */
|
||||
#ifdef HDDTEMP
|
||||
" * hddtemp\n"
|
||||
#endif /* HDDTEMP */
|
||||
#ifdef SETI
|
||||
" * seti\n"
|
||||
#endif /* SETI*/
|
||||
"\n");
|
||||
|
||||
exit(0);
|
||||
@ -395,11 +389,6 @@ static char original_text[] =
|
||||
"${color grey}Networking:\n"
|
||||
" Up:$color ${upspeed eth0} k/s${color grey} - Down:$color ${downspeed eth0} k/s\n"
|
||||
"$hr\n"
|
||||
#ifdef SETI
|
||||
"${color grey}SETI@Home Statistics:\n"
|
||||
"${color grey}Seti Unit Number:$color $seti_credit\n"
|
||||
"${color grey}Seti Progress:$color $seti_prog% $seti_progbar\n"
|
||||
#endif
|
||||
#ifdef MPD
|
||||
"${color grey}MPD: $mpd_status $mpd_artist - $mpd_title from $mpd_album at $mpd_vol\n"
|
||||
"Bitrate: $mpd_bitrate\n" "Progress: $mpd_bar\n"
|
||||
@ -972,18 +961,6 @@ enum text_object_type {
|
||||
OBJ_new_mails,
|
||||
OBJ_nodename,
|
||||
OBJ_pre_exec,
|
||||
#ifdef MLDONKEY
|
||||
OBJ_ml_upload_counter,
|
||||
OBJ_ml_download_counter,
|
||||
OBJ_ml_nshared_files,
|
||||
OBJ_ml_shared_counter,
|
||||
OBJ_ml_tcp_upload_rate,
|
||||
OBJ_ml_tcp_download_rate,
|
||||
OBJ_ml_udp_upload_rate,
|
||||
OBJ_ml_udp_download_rate,
|
||||
OBJ_ml_ndownloaded_files,
|
||||
OBJ_ml_ndownloading_files,
|
||||
#endif
|
||||
OBJ_processes,
|
||||
OBJ_running_processes,
|
||||
OBJ_shadecolor,
|
||||
@ -1019,11 +996,6 @@ enum text_object_type {
|
||||
OBJ_apm_battery_time,
|
||||
OBJ_apm_battery_life,
|
||||
#endif /* __FreeBSD__ */
|
||||
#ifdef SETI
|
||||
OBJ_seti_prog,
|
||||
OBJ_seti_progbar,
|
||||
OBJ_seti_credit,
|
||||
#endif
|
||||
#ifdef MPD
|
||||
OBJ_mpd_title,
|
||||
OBJ_mpd_artist,
|
||||
@ -1761,16 +1733,6 @@ static struct text_object *new_text_object_internal()
|
||||
return obj;
|
||||
}
|
||||
|
||||
#ifdef MLDONKEY
|
||||
void ml_cleanup()
|
||||
{
|
||||
if (mlconfig.mldonkey_hostname) {
|
||||
free(mlconfig.mldonkey_hostname);
|
||||
mlconfig.mldonkey_hostname = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void free_text_objects(unsigned int count, struct text_object *objs)
|
||||
{
|
||||
unsigned int i;
|
||||
@ -2716,18 +2678,6 @@ static struct text_object *construct_text_object(const char *s, const char *arg,
|
||||
scan_mixer_bar(arg, &obj->data.mixerbar.l,
|
||||
&obj->data.mixerbar.w, &obj->data.mixerbar.h);
|
||||
END
|
||||
#ifdef MLDONKEY
|
||||
OBJ(ml_upload_counter, INFO_MLDONKEY)
|
||||
END OBJ(ml_download_counter, INFO_MLDONKEY)
|
||||
END OBJ(ml_nshared_files, INFO_MLDONKEY)
|
||||
END OBJ(ml_shared_counter, INFO_MLDONKEY)
|
||||
END OBJ(ml_tcp_upload_rate, INFO_MLDONKEY)
|
||||
END OBJ(ml_tcp_download_rate, INFO_MLDONKEY)
|
||||
END OBJ(ml_udp_upload_rate, INFO_MLDONKEY)
|
||||
END OBJ(ml_udp_download_rate, INFO_MLDONKEY)
|
||||
END OBJ(ml_ndownloaded_files, INFO_MLDONKEY)
|
||||
END OBJ(ml_ndownloading_files, INFO_MLDONKEY) END
|
||||
#endif
|
||||
OBJ(new_mails, INFO_MAIL)
|
||||
END OBJ(nodename, 0)
|
||||
END OBJ(processes, INFO_PROCS)
|
||||
@ -2859,11 +2809,6 @@ static struct text_object *construct_text_object(const char *s, const char *arg,
|
||||
OBJ(apm_battery_life, 0) END
|
||||
OBJ(apm_battery_time, 0) END
|
||||
#endif /* __FreeBSD__ */
|
||||
#ifdef SETI
|
||||
OBJ(seti_prog, INFO_SETI) END OBJ(seti_progbar, INFO_SETI)
|
||||
(void) scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b);
|
||||
END OBJ(seti_credit, INFO_SETI) END
|
||||
#endif
|
||||
OBJ(imap_unseen, 0)
|
||||
if (arg) {
|
||||
// proccss
|
||||
@ -3245,10 +3190,6 @@ static void extract_variable_text(const char *p)
|
||||
text_object_count = 0;
|
||||
text_objects = NULL;
|
||||
|
||||
#ifdef MLDONKEY
|
||||
ml_cleanup();
|
||||
#endif /* MLDONKEY */
|
||||
|
||||
|
||||
list = extract_variable_text_internal(p);
|
||||
text_objects = list->text_objects;
|
||||
@ -4144,52 +4085,6 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object *
|
||||
OBJ(new_mails) {
|
||||
snprintf(p, p_max_size, "%d", cur->new_mail_count);
|
||||
}
|
||||
#ifdef MLDONKEY
|
||||
OBJ(ml_upload_counter) {
|
||||
snprintf(p, p_max_size, "%lld",
|
||||
mlinfo.upload_counter / 1048576);
|
||||
}
|
||||
OBJ(ml_download_counter) {
|
||||
snprintf(p, p_max_size, "%lld",
|
||||
mlinfo.download_counter /
|
||||
1048576);
|
||||
}
|
||||
OBJ(ml_nshared_files) {
|
||||
snprintf(p, p_max_size, "%i", mlinfo.nshared_files);
|
||||
}
|
||||
OBJ(ml_shared_counter) {
|
||||
snprintf(p, p_max_size, "%lld",
|
||||
mlinfo.shared_counter / 1048576);
|
||||
}
|
||||
OBJ(ml_tcp_upload_rate) {
|
||||
snprintf(p, p_max_size, "%.2f",
|
||||
(float) mlinfo.tcp_upload_rate /
|
||||
1024);
|
||||
}
|
||||
OBJ(ml_tcp_download_rate) {
|
||||
snprintf(p, p_max_size, "%.2f",
|
||||
(float) mlinfo.tcp_download_rate /
|
||||
1024);
|
||||
}
|
||||
OBJ(ml_udp_upload_rate) {
|
||||
snprintf(p, p_max_size, "%.2f",
|
||||
(float) mlinfo.udp_upload_rate /
|
||||
1024);
|
||||
}
|
||||
OBJ(ml_udp_download_rate) {
|
||||
snprintf(p, p_max_size, "%.2f",
|
||||
(float) mlinfo.udp_download_rate /
|
||||
1024);
|
||||
}
|
||||
OBJ(ml_ndownloaded_files) {
|
||||
snprintf(p, p_max_size, "%i",
|
||||
mlinfo.ndownloaded_files);
|
||||
}
|
||||
OBJ(ml_ndownloading_files) {
|
||||
snprintf(p, p_max_size, "%i",
|
||||
mlinfo.ndownloading_files);
|
||||
}
|
||||
#endif
|
||||
|
||||
OBJ(nodename) {
|
||||
snprintf(p, p_max_size, "%s",
|
||||
@ -4352,20 +4247,6 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object *
|
||||
free(msg);
|
||||
}
|
||||
#endif /* __FreeBSD__ */
|
||||
#ifdef SETI
|
||||
OBJ(seti_prog) {
|
||||
snprintf(p, p_max_size, "%.2f",
|
||||
cur->seti_prog * 100.0f);
|
||||
}
|
||||
OBJ(seti_progbar) {
|
||||
new_bar(p, obj->data.pair.a,
|
||||
obj->data.pair.b,
|
||||
(int) (cur->seti_prog * 255.0f));
|
||||
}
|
||||
OBJ(seti_credit) {
|
||||
snprintf(p, p_max_size, "%.0f", cur->seti_credit);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MPD
|
||||
OBJ(mpd_title) {
|
||||
@ -6152,18 +6033,11 @@ void clean_up(void)
|
||||
text_object_count = 0;
|
||||
text_objects = NULL;
|
||||
|
||||
#ifdef MLDONKEY
|
||||
ml_cleanup();
|
||||
#endif /* MLDONKEY */
|
||||
|
||||
if (text != original_text)
|
||||
free(text);
|
||||
|
||||
free(current_config);
|
||||
free(current_mail_spool);
|
||||
#ifdef SETI
|
||||
free(seti_dir);
|
||||
#endif
|
||||
#ifdef TCP_PORT_MONITOR
|
||||
destroy_tcp_port_monitor_collection( info.p_tcp_port_monitor_collection );
|
||||
info.p_tcp_port_monitor_collection = NULL;
|
||||
@ -6288,12 +6162,6 @@ static void set_default_configurations(void)
|
||||
no_buffers = 1;
|
||||
update_interval = 10.0;
|
||||
stuff_in_upper_case = 0;
|
||||
#ifdef MLDONKEY
|
||||
mlconfig.mldonkey_hostname = strdup("127.0.0.1");
|
||||
mlconfig.mldonkey_port = 4001;
|
||||
mlconfig.mldonkey_login = NULL;
|
||||
mlconfig.mldonkey_password = NULL;
|
||||
#endif
|
||||
|
||||
#ifdef TCP_PORT_MONITOR
|
||||
tcp_port_monitor_collection_args.min_port_monitors = MIN_PORT_MONITORS_DEFAULT;
|
||||
@ -6618,44 +6486,6 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, b) == 0)
|
||||
CONF("no_buffers") {
|
||||
no_buffers = string_to_bool(value);
|
||||
}
|
||||
#ifdef MLDONKEY
|
||||
CONF("mldonkey_hostname") {
|
||||
if (value) {
|
||||
if (mlconfig.mldonkey_hostname != NULL) {
|
||||
free(mlconfig.mldonkey_hostname);
|
||||
}
|
||||
mlconfig.mldonkey_hostname = strdup(value);
|
||||
}
|
||||
else
|
||||
CONF_ERR;
|
||||
}
|
||||
CONF("mldonkey_port") {
|
||||
if (value)
|
||||
mlconfig.mldonkey_port = atoi(value);
|
||||
else
|
||||
CONF_ERR;
|
||||
}
|
||||
CONF("mldonkey_login") {
|
||||
if (value) {
|
||||
if (mlconfig.mldonkey_login != NULL) {
|
||||
free(mlconfig.mldonkey_login);
|
||||
}
|
||||
mlconfig.mldonkey_login = strdup(value);
|
||||
}
|
||||
else
|
||||
CONF_ERR;
|
||||
}
|
||||
CONF("mldonkey_password") {
|
||||
if (value) {
|
||||
if (mlconfig.mldonkey_password != NULL) {
|
||||
free(mlconfig.mldonkey_password);
|
||||
}
|
||||
mlconfig.mldonkey_password = strdup(value);
|
||||
}
|
||||
else
|
||||
CONF_ERR;
|
||||
}
|
||||
#endif
|
||||
CONF("pad_percents") {
|
||||
pad_percents = atoi(value);
|
||||
}
|
||||
@ -6748,14 +6578,6 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, b) == 0)
|
||||
CONF("uppercase") {
|
||||
stuff_in_upper_case = string_to_bool(value);
|
||||
}
|
||||
#ifdef SETI
|
||||
CONF("seti_dir") {
|
||||
seti_dir = (char *)
|
||||
malloc(strlen(value)
|
||||
+ 1);
|
||||
strcpy(seti_dir, value);
|
||||
}
|
||||
#endif
|
||||
CONF("text") {
|
||||
if (text != original_text)
|
||||
free(text);
|
||||
|
91
src/conky.h
91
src/conky.h
@ -209,40 +209,34 @@ 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,
|
||||
INFO_MPD = 14,
|
||||
#endif
|
||||
INFO_TOP = 16,
|
||||
#ifdef MLDONKEY
|
||||
INFO_MLDONKEY = 18,
|
||||
#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
|
||||
#ifdef AUDACIOUS
|
||||
INFO_AUDACIOUS = 23,
|
||||
INFO_AUDACIOUS = 20,
|
||||
#endif
|
||||
#ifdef BMPX
|
||||
INFO_BMPX = 24,
|
||||
INFO_BMPX = 21,
|
||||
#endif
|
||||
#ifdef XMMS2
|
||||
INFO_XMMS2 = 25,
|
||||
INFO_XMMS2 = 22,
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -281,10 +275,6 @@ struct information {
|
||||
int new_mail_count, mail_count;
|
||||
struct mail_s* mail;
|
||||
int mail_running;
|
||||
#ifdef SETI
|
||||
float seti_prog;
|
||||
float seti_credit;
|
||||
#endif
|
||||
#ifdef MPD
|
||||
struct mpd_s mpd;
|
||||
mpd_Connection *conn;
|
||||
@ -534,14 +524,6 @@ 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;
|
||||
@ -559,44 +541,11 @@ char *get_apm_battery_time(void);
|
||||
void update_mpd();
|
||||
#endif
|
||||
|
||||
/* in xmm2.c */
|
||||
/* in xmms2.c */
|
||||
#ifdef XMMS2
|
||||
void update_xmms2();
|
||||
#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);
|
||||
#endif
|
||||
|
||||
/* in hddtemp.c */
|
||||
#ifdef HDDTEMP
|
||||
int scan_hddtemp(const char *arg, char **dev, char **addr, int *port);
|
||||
|
463
src/mldonkey.c
463
src/mldonkey.c
@ -1,463 +0,0 @@
|
||||
/*
|
||||
* mldonkey.c: MLDonkey stuff for Conky
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <netdb.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "conky.h"
|
||||
|
||||
int64 buf_to_int(char *buf, int pos, int size);
|
||||
void int_to_buf(int64 i, char *buf, int pos, int size);
|
||||
|
||||
#define BUF16_TO_INT(buf, pos) buf_to_int((buf), (pos), 2)
|
||||
#define BUF32_TO_INT(buf, pos) buf_to_int((buf), (pos), 4)
|
||||
#define BUF64_TO_INT(buf, pos) buf_to_int((buf), (pos), 8)
|
||||
|
||||
#define INT_TO_BUF16(i, buf, pos) int_to_buf((i), (buf), (pos), 2)
|
||||
#define INT_TO_BUF32(i, buf, pos) int_to_buf((i), (buf), (pos), 4)
|
||||
#define INT_TO_BUF64(i, buf, pos) int_to_buf((i), (buf), (pos), 8)
|
||||
|
||||
mldonkey_info mlinfo;
|
||||
mldonkey_config mlconfig;
|
||||
|
||||
/* Call this function to update the information about mldonkey.
|
||||
* Note that the function will not reconnect to mldonkey if the
|
||||
* pointer to the mldonkey_config has not changed. As it uses static
|
||||
* data, it cannot be used in a multithreaded env.
|
||||
* Returns 1 if connected and info filled, 0 if connected but not filled,
|
||||
* -1 otherwise. */
|
||||
|
||||
enum to_gui {
|
||||
CoreProtocol, /* 0 */
|
||||
Options_info,
|
||||
RESERVED2,
|
||||
DefineSearches,
|
||||
Result_info,
|
||||
Search_result,
|
||||
Search_waiting,
|
||||
File_info,
|
||||
File_downloaded,
|
||||
File_availability,
|
||||
File_source, /* 10 */
|
||||
Server_busy,
|
||||
Server_user,
|
||||
Server_state,
|
||||
Server_info,
|
||||
Client_info,
|
||||
Client_state,
|
||||
Client_friend,
|
||||
Client_file,
|
||||
Console,
|
||||
Network_info, /* 20 */
|
||||
User_info,
|
||||
Room_info,
|
||||
Room_message,
|
||||
Room_add_user,
|
||||
Client_stats,
|
||||
Server_info_v2,
|
||||
MessageFromClient,
|
||||
ConnectedServers,
|
||||
DownloadFiles,
|
||||
DownloadedFiles, /* 30 */
|
||||
Room_info_v2,
|
||||
Room_remove_user,
|
||||
Shared_file_info,
|
||||
Shared_file_upload,
|
||||
Shared_file_unshared,
|
||||
Add_section_option,
|
||||
Client_stats_v2,
|
||||
Add_plugin_option,
|
||||
Client_stats_v3,
|
||||
File_info_v2, /* 40 */
|
||||
DownloadFiles_v2,
|
||||
DownloadedFiles_v2,
|
||||
File_info_v3,
|
||||
DownloadFiles_v3,
|
||||
DownloadedFiles_v3,
|
||||
File_downloaded_v2,
|
||||
BadPassword,
|
||||
Shared_file_info_v2,
|
||||
Client_stats_v4, /* 49 */
|
||||
};
|
||||
|
||||
#define MLDONKEY_DISCONNECTED 0
|
||||
#define MLDONKEY_CONNECTING 1
|
||||
#define MLDONKEY_AUTHENTICATING 2
|
||||
#define MLDONKEY_CONNECTED 3
|
||||
|
||||
#define MAX_MESSAGE_LEN 65000
|
||||
static int write_pos = 0;
|
||||
static char write_buf[MAX_MESSAGE_LEN];
|
||||
static char read_buf[MAX_MESSAGE_LEN];
|
||||
static int read_pos;
|
||||
static int mldonkey_sock = -1;
|
||||
static int mldonkey_state = MLDONKEY_DISCONNECTED;
|
||||
static mldonkey_config *old_config = NULL;
|
||||
|
||||
/* int64 ------------------------------ */
|
||||
|
||||
int64 buf_to_int(char *buf, int pos, int size)
|
||||
{
|
||||
int i;
|
||||
int64 res = 0;
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
res += (buf[pos + i] & 0xFF) << (8 * i);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void int_to_buf(int64 i, char *buf, int pos, int size)
|
||||
{
|
||||
int j;
|
||||
|
||||
for (j = 0; j < size; j++) {
|
||||
buf[pos + j] = (i & (-1)) >> (8 * j);
|
||||
}
|
||||
}
|
||||
|
||||
/* Write operations --------------------- */
|
||||
|
||||
void init_message()
|
||||
{
|
||||
write_pos = 0;
|
||||
}
|
||||
|
||||
void write_int8(int code)
|
||||
{
|
||||
write_buf[write_pos++] = code;
|
||||
}
|
||||
|
||||
void write_opcode(int code)
|
||||
{
|
||||
write_buf[write_pos++] = code;
|
||||
}
|
||||
|
||||
void write_int16(int code)
|
||||
{
|
||||
INT_TO_BUF16(code, write_buf, write_pos);
|
||||
write_pos += 2;
|
||||
}
|
||||
|
||||
void write_int32(int code)
|
||||
{
|
||||
INT_TO_BUF32(code, write_buf, write_pos);
|
||||
write_pos += 4;
|
||||
}
|
||||
|
||||
void write_int64(int64 code)
|
||||
{
|
||||
INT_TO_BUF64(code, write_buf, write_pos);
|
||||
write_pos += 8;
|
||||
}
|
||||
|
||||
void write_string(char *str)
|
||||
{
|
||||
if (str == NULL) {
|
||||
write_int16(0);
|
||||
} else {
|
||||
int len = strlen(str);
|
||||
write_int16(len);
|
||||
memcpy((void *) (write_buf + write_pos), (void *) str,
|
||||
(size_t) len);
|
||||
write_pos += len;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int write_message(char *mtype)
|
||||
{
|
||||
char header[4];
|
||||
|
||||
INT_TO_BUF32(write_pos, header, 0);
|
||||
if (4 != write(mldonkey_sock, header, 4) ||
|
||||
write_pos != write(mldonkey_sock, (void *) write_buf,
|
||||
(size_t) write_pos)) {
|
||||
ERR("Error in transmitting %s\n", mtype);
|
||||
write_pos = 0;
|
||||
|
||||
/* Immediatly close the connection */
|
||||
close(mldonkey_sock);
|
||||
mldonkey_state = MLDONKEY_DISCONNECTED;
|
||||
mldonkey_sock = -1;
|
||||
return -1;
|
||||
} else {
|
||||
write_pos = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Read operations ----------------------------*/
|
||||
|
||||
int read_int8()
|
||||
{
|
||||
return read_buf[read_pos++];
|
||||
}
|
||||
|
||||
int read_int16()
|
||||
{
|
||||
int i = BUF16_TO_INT(read_buf, read_pos);
|
||||
read_pos += 2;
|
||||
return i;
|
||||
}
|
||||
|
||||
int read_int32()
|
||||
{
|
||||
int i = BUF32_TO_INT(read_buf, read_pos);
|
||||
read_pos += 4;
|
||||
return i;
|
||||
}
|
||||
|
||||
int64 read_int64()
|
||||
{
|
||||
int64 i = BUF64_TO_INT(read_buf, read_pos);
|
||||
read_pos += 8;
|
||||
return i;
|
||||
}
|
||||
|
||||
char *read_string()
|
||||
{
|
||||
char *buf;
|
||||
int len;
|
||||
|
||||
len = BUF16_TO_INT(read_buf, read_pos);
|
||||
read_pos += 2;
|
||||
|
||||
buf = (char *) malloc((size_t) len + 1);
|
||||
memmove(read_buf + read_pos, buf, len);
|
||||
buf[len] = 0;
|
||||
read_pos += len;
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* protocol impl. ----------------------------- */
|
||||
|
||||
void close_sock();
|
||||
|
||||
/* This function returns the number of messages read, 0 if it blocks,
|
||||
-1 on error. */
|
||||
int cut_messages(int reinit)
|
||||
{
|
||||
int nread;
|
||||
static int toread = 0;
|
||||
static int pos = 0;
|
||||
|
||||
if (reinit) {
|
||||
toread = 0;
|
||||
pos = 0;
|
||||
read_pos = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
if (toread == 0) {
|
||||
nread =
|
||||
read(mldonkey_sock, read_buf + pos, 4 - pos);
|
||||
if (nread <= 0) {
|
||||
if (errno == EAGAIN) {
|
||||
return 0;
|
||||
} else {
|
||||
close_sock();
|
||||
pos = 0;
|
||||
toread = 0;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
pos += nread;
|
||||
if (pos == 4) {
|
||||
toread = BUF32_TO_INT(read_buf, 0);
|
||||
pos = 0;
|
||||
}
|
||||
} else {
|
||||
nread =
|
||||
read(mldonkey_sock, read_buf + pos,
|
||||
toread - pos);
|
||||
if (nread <= 0) {
|
||||
if (errno == EAGAIN)
|
||||
return 0;
|
||||
else {
|
||||
pos = 0;
|
||||
toread = 0;
|
||||
close_sock();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
pos += nread;
|
||||
if (pos == toread) {
|
||||
/* We have one message !!! */
|
||||
int old_pos = pos;
|
||||
read_pos = 0;
|
||||
pos = 0;
|
||||
toread = 0;
|
||||
|
||||
return old_pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void close_sock()
|
||||
{
|
||||
old_config = NULL;
|
||||
if (mldonkey_sock >= 0)
|
||||
close(mldonkey_sock);
|
||||
mldonkey_sock = -1;
|
||||
mldonkey_state = MLDONKEY_DISCONNECTED;
|
||||
cut_messages(1);
|
||||
}
|
||||
|
||||
int mldonkey_connect(mldonkey_config * config)
|
||||
{
|
||||
if (config != old_config) {
|
||||
struct sockaddr_in sa;
|
||||
int retcode;
|
||||
close_sock();
|
||||
|
||||
|
||||
old_config = config;
|
||||
/* resolve hostname */
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
|
||||
if (config->mldonkey_hostname == NULL)
|
||||
config->mldonkey_hostname = "127.0.0.1";
|
||||
if (config->mldonkey_hostname[0] >= '0' &&
|
||||
config->mldonkey_hostname[0] <= '9') {
|
||||
#ifdef HAS_INET_ATON
|
||||
if (inet_aton
|
||||
(config->mldonkey_hostname, &sa.sin_addr) == 0)
|
||||
return -1;
|
||||
#else
|
||||
|
||||
sa.sin_addr.s_addr =
|
||||
inet_addr(config->mldonkey_hostname);
|
||||
if (sa.sin_addr.s_addr == (unsigned int) -1)
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
} else {
|
||||
struct hostent *hp;
|
||||
hp = gethostbyname(config->mldonkey_hostname);
|
||||
if (hp == (struct hostent *) NULL)
|
||||
return -1;
|
||||
sa.sin_addr.s_addr =
|
||||
(unsigned long) hp->h_addr_list[0];
|
||||
}
|
||||
|
||||
sa.sin_port = htons(config->mldonkey_port);
|
||||
sa.sin_family = AF_INET;
|
||||
|
||||
if ((mldonkey_sock = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
|
||||
ERR("Opening socket");
|
||||
close_sock();
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (connect
|
||||
(mldonkey_sock, (struct sockaddr *) &sa,
|
||||
sizeof(sa)) < 0) {
|
||||
if (errno != EAGAIN && errno != EINTR
|
||||
&& errno != EINPROGRESS
|
||||
&& errno != EWOULDBLOCK) {
|
||||
// ERR("Connection failed");
|
||||
close_sock();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
retcode = fcntl(mldonkey_sock, F_GETFL, 0);
|
||||
if (retcode == -1 ||
|
||||
fcntl(mldonkey_sock, F_SETFL,
|
||||
retcode | O_NONBLOCK) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
mldonkey_state = MLDONKEY_CONNECTING;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mldonkey_can_read()
|
||||
{
|
||||
return cut_messages(0);
|
||||
}
|
||||
|
||||
int mldonkey_info_message(mldonkey_info * info)
|
||||
{
|
||||
int opcode = read_int16();
|
||||
|
||||
switch (opcode) {
|
||||
|
||||
case CoreProtocol:
|
||||
init_message();
|
||||
|
||||
write_int16(0); /* GUI protocol */
|
||||
write_int32(10); /* Version 10 ! */
|
||||
write_message("GuiProtocol");
|
||||
|
||||
write_int16(47); /* GUI protocol */
|
||||
|
||||
write_int16(1);
|
||||
write_int32(1);
|
||||
write_int8(1);
|
||||
write_message("GuiExtensions");
|
||||
|
||||
init_message();
|
||||
write_int16(5); /* Password */
|
||||
write_string(old_config->mldonkey_password);
|
||||
write_message("Password");
|
||||
|
||||
break;
|
||||
|
||||
case BadPassword:
|
||||
ERR("Bad Password\n");
|
||||
close_sock();
|
||||
break;
|
||||
|
||||
case Client_stats:
|
||||
case Client_stats_v2:
|
||||
case Client_stats_v3:
|
||||
ERR("Client stats format too old...\n");
|
||||
break;
|
||||
|
||||
case Client_stats_v4:
|
||||
mldonkey_state = MLDONKEY_CONNECTED;
|
||||
|
||||
info->upload_counter = read_int64();
|
||||
info->download_counter = read_int64();
|
||||
info->shared_counter = read_int64();
|
||||
info->nshared_files = read_int32();
|
||||
info->tcp_upload_rate = read_int32();
|
||||
info->tcp_download_rate = read_int32();
|
||||
info->udp_upload_rate = read_int32();
|
||||
info->udp_download_rate = read_int32();
|
||||
info->ndownloading_files = read_int32();
|
||||
info->ndownloaded_files = read_int32();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int get_mldonkey_status(mldonkey_config * config, mldonkey_info * info)
|
||||
{
|
||||
if (mldonkey_connect(config) >= 0) {
|
||||
while (mldonkey_can_read() > 0) {
|
||||
mldonkey_info_message(info);
|
||||
}
|
||||
}
|
||||
return mldonkey_state;
|
||||
}
|
111
src/seti.c
111
src/seti.c
@ -1,111 +0,0 @@
|
||||
/*
|
||||
* seti.c: information about SETI for Conky
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include "conky.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
char *seti_dir = NULL;
|
||||
|
||||
/*
|
||||
* Need to code for BOINC, because the old SETI@Home does not use xml to store data.
|
||||
* Perhaps in the .conkyrc file there could be an option for BOINC or old SETI.
|
||||
*/
|
||||
|
||||
/*static float seti_get_float (FILE *fp, const char *name)
|
||||
{
|
||||
char buffer[80];
|
||||
char *token;
|
||||
|
||||
while (!feof(fp) && !ferror (fp))
|
||||
{
|
||||
fgets(buffer, 80, fp);
|
||||
token = strtok(buffer, ">");
|
||||
|
||||
if (strcmp(token, name) == 0)
|
||||
{
|
||||
token = strtok(NULL, "<");
|
||||
if ( token != NULL )
|
||||
return atof (token);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0.0f;
|
||||
}*/
|
||||
|
||||
float seti_get_data(FILE * fp, const char *name)
|
||||
{
|
||||
char token[1000];
|
||||
char buffer[1000];
|
||||
float data;
|
||||
|
||||
while (fgets(token, 1000, fp) != NULL) //read the file
|
||||
if (strncmp(token, name, strlen(name)) == 0) { //and search for the data in name
|
||||
strcpy(buffer, strchr(token, '=') + 1); //copy just the number
|
||||
break;
|
||||
}
|
||||
data = atof(buffer);
|
||||
return data;
|
||||
}
|
||||
|
||||
void update_seti()
|
||||
{
|
||||
if (seti_dir == NULL)
|
||||
return;
|
||||
|
||||
char filename[80];
|
||||
|
||||
struct information *current_info = &info;
|
||||
|
||||
current_info->seti_prog = current_info->seti_credit = 0.0f;
|
||||
|
||||
/* read total user credit */
|
||||
|
||||
/*FILE *fp = fopen(filename, "r");
|
||||
if (!fp)
|
||||
return;
|
||||
|
||||
seti_credit = seti_get_float(fp, "<user_total_credit");
|
||||
|
||||
fclose (fp); */
|
||||
|
||||
snprintf(filename, 80, "%s/user_info.sah", seti_dir);
|
||||
|
||||
FILE *fp = fopen(filename, "r");
|
||||
|
||||
if (!fp) {
|
||||
return;
|
||||
}
|
||||
|
||||
current_info->seti_credit = seti_get_data(fp, "nresults");
|
||||
|
||||
fclose(fp);
|
||||
|
||||
/* read current progress */
|
||||
|
||||
/*snprintf(filename, 80, "%s/slots/0/state.sah", seti_dir);
|
||||
fp = fopen(filename, "r");
|
||||
if (!fp)
|
||||
return;
|
||||
|
||||
seti_prog = seti_get_float(fp, "<prog");
|
||||
|
||||
fclose (fp);
|
||||
|
||||
snprintf(filename, 80, "%s/slots/0/init_data.xml", seti_dir); */
|
||||
|
||||
snprintf(filename, 80, "%s/state.sah", seti_dir);
|
||||
|
||||
fp = fopen(filename, "r");
|
||||
if (!fp)
|
||||
return;
|
||||
|
||||
current_info->seti_prog = seti_get_data(fp, "prog");
|
||||
|
||||
fclose(fp);
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user