1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-02-09 15:38:38 +00:00

* Introduced (buggy) support for IMAP IDLE

* Added support for MOC (the console audio player) (thanks henux)
* Added scroll step patch (thanks asto)


git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1252 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Brenden Matthews 2008-09-24 06:59:45 +00:00
parent 0c2c9dd038
commit 7de6c1d061
11 changed files with 570 additions and 108 deletions

View File

@ -115,6 +115,9 @@ Gwenhael LE MOINE <cycojesus at yahoo dot fr>
Hannu Saransaari <hipo at users dot sourceforge dot net>
Main code
Henri Häkkinen <henux at users dot sourceforge dot net>
MOC support
hinokind <hinokind at users dot sourceforge dot net>
support negative values in human_readable()
@ -305,6 +308,9 @@ Toni Spets hifi <spets at users dot sourceforge dot net>
Linux wifi code
RSS code (created with Mikko Sysikaski)
Tris <asto at users dot sourceforge dot net>
Scroll step patch
tyir <tyir at users dot sourceforge dot net>
MPD features patch 1319461

View File

@ -1,5 +1,10 @@
# $Id$
2008-09-24
* Introduced (buggy) support for IMAP IDLE
* Added support for MOC (the console audio player) (thanks henux)
* Added scroll step patch (thanks asto)
2008-09-11
* Maybe fix missing include bug
(http://bugs.gentoo.org/show_bug.cgi?id=235233)

65
README
View File

@ -1076,6 +1076,50 @@ conky(1) conky(1)
Percentage of memory in use
1mmoc_state0m
Current state of MOC; playing, stopped etc.
1mmoc_file0m
File name of the current MOC song
1mmoc_title0m
Title of the current MOC song
1mmoc_artist0m
Artist of the current MOC song
1mmoc_song0m
The current song name being played in MOC.
1mmoc_album0m
Album of the current MOC song
1mmoc_totaltime0m
Total length of the current MOC song
1mmoc_timeleft0m
Time left in the current MOC song
1mmoc_curtime0m
Current time of the current MOC song
1mmoc_bitrate0m
Bitrate in the current MOC song
1mmoc_rate0m
Rate of the current MOC song
1mmonitor0m
Number of the monitor on which conky is running
@ -1239,16 +1283,17 @@ conky(1) conky(1)
Running processes (not sleeping), requires Linux 2.6
1mscroll length text0m
Scroll text showing length number of characters at the same
time. The text may also contain variables. If a var creates out
put on multiple lines then the lines are placed behind each oth
er separated with a |-sign. Do NOT use vars that change colors
or otherwise affect the design inside a scrolling text. If you
want spaces between the start and the end of text, place them
at the end of text not at the front ("foobar" and " foobar"
can both generate "barfoo" but "foobar " will keep the spaces
like this "bar foo").
1mscroll length (step) text0m
Scroll text by step characters showing length number of
characters at the same time. The text may also contain vari
ables. step is optional and defaults to 1 if not set. If a var
creates output on multiple lines then the lines are placed be
hind each other separated with a |-sign. Do NOT use vars that
change colors or otherwise affect the design inside a scrolling
text. If you want spaces between the start and the end of
text, place them at the end of text not at the front ("foo
bar" and " foobar" can both generate "barfoo" but "foobar " will
keep the spaces like this "bar foo").
1mshadecolor (color)0m

View File

@ -203,6 +203,19 @@ if test x$want_mpd = xyes; then
AC_DEFINE(MPD, 1, [Define if you want MPD support])
fi
dnl
dnl MOC
dnl
AC_ARG_ENABLE([moc],
AC_HELP_STRING([--disable-moc], [disable if you do not want MOC support @<:@default=yes@:>@]),
[want_moc="$enableval"], [want_moc=yes])
AM_CONDITIONAL(BUILD_MOC, test x$want_moc = xyes)
if test x$want_moc = xyes; then
AC_DEFINE(MOC, 1, [Define if you want MOC support])
fi
dnl
dnl XMMS2
dnl
@ -680,6 +693,7 @@ $PACKAGE $VERSION configured successfully:
Audacious: $want_audacious
BMPx: $want_bmpx
MPD: $want_mpd
MOC: $want_moc
XMMS2: $want_xmms2
* General:

View File

@ -908,6 +908,50 @@ Total amount of memory
\fB\*(T<\fBmemperc\fR\*(T>\fR
Percentage of memory in use
.TP
\fB\*(T<\fBmoc_state\fR\*(T>\fR
Current state of MOC; playing, stopped etc.
.TP
\fB\*(T<\fBmoc_file\fR\*(T>\fR
File name of the current MOC song
.TP
\fB\*(T<\fBmoc_title\fR\*(T>\fR
Title of the current MOC song
.TP
\fB\*(T<\fBmoc_artist\fR\*(T>\fR
Artist of the current MOC song
.TP
\fB\*(T<\fBmoc_song\fR\*(T>\fR
The current song name being played in MOC.
.TP
\fB\*(T<\fBmoc_album\fR\*(T>\fR
Album of the current MOC song
.TP
\fB\*(T<\fBmoc_totaltime\fR\*(T>\fR
Total length of the current MOC song
.TP
\fB\*(T<\fBmoc_timeleft\fR\*(T>\fR
Time left in the current MOC song
.TP
\fB\*(T<\fBmoc_curtime\fR\*(T>\fR
Current time of the current MOC song
.TP
\fB\*(T<\fBmoc_bitrate\fR\*(T>\fR
Bitrate in the current MOC song
.TP
\fB\*(T<\fBmoc_rate\fR\*(T>\fR
Rate of the current MOC song
.TP
\fB\*(T<\fBmonitor\fR\*(T>\fR
Number of the monitor on which conky is running
@ -1067,8 +1111,8 @@ Total processes (sleeping and running)
Running processes (not sleeping), requires Linux 2.6
.TP
\fB\*(T<\fBscroll\fR\*(T>\fR \*(T<\fBlength text\fR\*(T>
Scroll 'text' showing 'length' number of characters at the same time. The text may also contain variables. If a var creates output on multiple lines then the lines are placed behind each other separated with a '|'-sign. Do NOT use vars that change colors or otherwise affect the design inside a scrolling text. If you want spaces between the start and the end of 'text', place them at the end of 'text' not at the front ("foobar" and " foobar" can both generate "barfoo" but "foobar " will keep the spaces like this "bar foo").
\fB\*(T<\fBscroll\fR\*(T>\fR \*(T<\fBlength (step) text\fR\*(T>
Scroll 'text' by 'step' characters showing 'length' number of characters at the same time. The text may also contain variables. 'step' is optional and defaults to 1 if not set. If a var creates output on multiple lines then the lines are placed behind each other separated with a '|'-sign. Do NOT use vars that change colors or otherwise affect the design inside a scrolling text. If you want spaces between the start and the end of 'text', place them at the end of 'text' not at the front ("foobar" and " foobar" can both generate "barfoo" but "foobar " will keep the spaces like this "bar foo").
.TP
\fB\*(T<\fBshadecolor\fR\*(T>\fR \*(T<\fB(color)\fR\*(T>

View File

@ -1248,6 +1248,105 @@
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>moc_state</option></command>
</term>
<listitem>
Current state of MOC; playing, stopped etc.
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>moc_file</option></command>
</term>
<listitem>
File name of the current MOC song
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>moc_title</option></command>
</term>
<listitem>
Title of the current MOC song
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>moc_artist</option></command>
</term>
<listitem>
Artist of the current MOC song
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>moc_song</option></command>
</term>
<listitem>
The current song name being played in MOC.
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>moc_album</option></command>
</term>
<listitem>
Album of the current MOC song
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>moc_totaltime</option></command>
</term>
<listitem>
Total length of the current MOC song
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>moc_timeleft</option></command>
</term>
<listitem>
Time left in the current MOC song
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>moc_curtime</option></command>
</term>
<listitem>
Current time of the current MOC song
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>moc_bitrate</option></command>
</term>
<listitem>
Bitrate in the current MOC song
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>moc_rate</option></command>
</term>
<listitem>
Rate of the current MOC song
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>monitor</option></command>
@ -1583,10 +1682,10 @@
<varlistentry>
<term>
<command><option>scroll</option></command>
<option>length text</option>
<option>length (step) text</option>
</term>
<listitem>
Scroll 'text' showing 'length' number of characters at the same time. The text may also contain variables. If a var creates output on multiple lines then the lines are placed behind each other separated with a '|'-sign. Do NOT use vars that change colors or otherwise affect the design inside a scrolling text. If you want spaces between the start and the end of 'text', place them at the end of 'text' not at the front ("foobar" and " foobar" can both generate "barfoo" but "foobar " will keep the spaces like this "bar foo").
Scroll 'text' by 'step' characters showing 'length' number of characters at the same time. The text may also contain variables. 'step' is optional and defaults to 1 if not set. If a var creates output on multiple lines then the lines are placed behind each other separated with a '|'-sign. Do NOT use vars that change colors or otherwise affect the design inside a scrolling text. If you want spaces between the start and the end of 'text', place them at the end of 'text' not at the front ("foobar" and " foobar" can both generate "barfoo" but "foobar " will keep the spaces like this "bar foo").
<para></para></listitem>
</varlistentry>

View File

@ -40,6 +40,10 @@ if BUILD_MPD
mpd = mpd.c libmpdclient.c
endif
if BUILD_MOC
moc = moc.c
endif
if BUILD_XMMS2
xmms2 = xmms2.c
endif
@ -109,6 +113,7 @@ conky_SOURCES = \
mail.c \
mixer.c \
$(mpd) \
$(moc) \
$(netbsd) \
$(openbsd) \
$(port_monitors) \
@ -146,6 +151,8 @@ EXTRA_DIST = \
rss.h \
mail.h \
mixer.h \
moc.h \
moc.c \
mpd.c \
mpd.h \
netbsd.c \

View File

@ -330,6 +330,23 @@ void update_stuff(void)
}
#endif
#ifdef MOC
if (NEED(INFO_MOC)) {
if (!info.moc.timed_thread) {
init_moc(&info.moc);
info.moc.timed_thread = timed_thread_create(&update_moc,
(void *) &info.moc, info.music_player_interval * 100000);
if (!info.moc.timed_thread) {
ERR("Failed to create MOC timed thread");
}
timed_thread_register(info.moc.timed_thread, &info.moc.timed_thread);
if (timed_thread_run(info.moc.timed_thread)) {
ERR("Failed to run MOC timed thread");
}
}
}
#endif
#ifdef XMMS2
if (NEED(INFO_XMMS2)) {
update_xmms2();

View File

@ -70,8 +70,9 @@
#define MAX_IF_BLOCK_DEPTH 5
#define MAX_TAIL_LINES 100
/* #define SIGNAL_BLOCKING */
#undef SIGNAL_BLOCKING
#define SIGNAL_BLOCKING
//#undef SIGNAL_BLOCKING
sigset_t oldmask;
static void print_version(void) __attribute__((noreturn));
@ -103,6 +104,9 @@ static void print_version(void)
#ifdef MPD
" * mpd\n"
#endif /* MPD */
#ifdef MOC
" * moc\n"
#endif /* MOC */
#ifdef XMMS2
" * xmms2\n"
#endif /* XMMS2 */
@ -138,6 +142,7 @@ static void print_version(void)
static const char *suffixes[] = { "B", "KiB", "MiB", "GiB", "TiB", "PiB", "" };
#ifdef X11
/* text size */
@ -1313,6 +1318,19 @@ enum text_object_type {
OBJ_mpd_file,
OBJ_mpd_percent,
OBJ_mpd_smart,
#endif
#ifdef MOC
OBJ_moc_state,
OBJ_moc_file,
OBJ_moc_title,
OBJ_moc_artist,
OBJ_moc_song,
OBJ_moc_album,
OBJ_moc_totaltime,
OBJ_moc_timeleft,
OBJ_moc_curtime,
OBJ_moc_bitrate,
OBJ_moc_rate,
#endif
OBJ_music_player_interval,
#ifdef XMMS2
@ -1511,6 +1529,7 @@ struct text_object {
struct {
char *text;
unsigned int show;
unsigned int step;
unsigned int start;
} scroll;
@ -1635,14 +1654,15 @@ void *imap_thread(void *arg)
char sendbuf[MAXDATASIZE];
char *reply;
unsigned int fail = 0;
unsigned int old_unseen = UINT_MAX;
unsigned int old_messages = UINT_MAX;
unsigned long old_unseen = ULONG_MAX;
unsigned long old_messages = ULONG_MAX;
struct stat stat_buf;
struct hostent he, *he_res = 0;
int he_errno;
char hostbuff[2048];
struct sockaddr_in their_addr; // connector's address information
struct mail_s *mail = (struct mail_s *)arg;
int has_idle = 0;
#ifdef HAVE_GETHOSTBYNAME_R
if (gethostbyname_r(mail->host, &he, hostbuff, sizeof(hostbuff), &he_res, &he_errno)) { // get the host info
@ -1736,6 +1756,10 @@ void *imap_thread(void *arg)
fail++;
break;
}
if (strstr(recvbuf, " IDLE ") != NULL) {
has_idle = 1;
}
strncpy(sendbuf, "a2 STATUS ", MAXDATASIZE);
strncat(sendbuf, mail->folder, MAXDATASIZE - strlen(sendbuf) - 1);
strncat(sendbuf, " (MESSAGES UNSEEN)\r\n",
@ -1763,6 +1787,7 @@ void *imap_thread(void *arg)
fail++;
break;
}
// now we get the data
reply = strstr(recvbuf, " (MESSAGES ");
reply += 2;
@ -1777,6 +1802,132 @@ void *imap_thread(void *arg)
&mail->unseen);
timed_thread_unlock(mail->p_timed_thread);
}
if (strlen(mail->command) > 1 && (mail->unseen > old_unseen
|| (mail->messages > old_messages && mail->unseen > 0))) {
// new mail goodie
if (system(mail->command) == -1) {
perror("system()");
}
}
fail = 0;
old_unseen = mail->unseen;
old_messages = mail->messages;
if (has_idle) {
strncpy(sendbuf, "a4 SELECT ", MAXDATASIZE);
strncat(sendbuf, mail->folder, MAXDATASIZE - strlen(sendbuf) - 1);
strncat(sendbuf, "\r\n", MAXDATASIZE - strlen(sendbuf) - 1);
if (send(sockfd, sendbuf, strlen(sendbuf), 0) == -1) {
perror("send a4");
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 a4");
fail++;
break;
}
}
recvbuf[numbytes] = '\0';
if (strstr(recvbuf, "a4 OK") == NULL) {
ERR("IMAP status failed: %s", recvbuf);
fail++;
break;
}
strncpy(sendbuf, "a5 IDLE\r\n", MAXDATASIZE);
if (send(sockfd, sendbuf, strlen(sendbuf), 0) == -1) {
perror("send a5");
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 a5");
fail++;
break;
}
}
recvbuf[numbytes] = '\0';
if (strstr(recvbuf, "+ idling") == NULL) {
ERR("IMAP status failed: %s", recvbuf);
fail++;
break;
}
recvbuf[0] = '\0';
while (1) {
FD_ZERO(&fdset);
FD_SET(sockfd, &fdset);
if (timed_thread_test(mail->p_timed_thread)) {
break;
}
res = pselect(sockfd + 1, &fdset, NULL, NULL, NULL, &oldmask);
if (res == -1 && errno == EINTR) {
timed_thread_exit(mail->p_timed_thread);
} else if (res > 0) {
if ((numbytes = recv(sockfd, recvbuf, MAXDATASIZE - 1, 0)) == -1) {
perror("recv idling");
fail++;
printf("fail\n");
break;
}
} else {
break;
}
recvbuf[numbytes] = '\0';
if (strlen(recvbuf) > 2) {
unsigned long messages, unseen;
char *buf = recvbuf;
buf = strstr(buf, "EXISTS");
if (buf) {
// back up until we reach '*'
while (buf >= recvbuf && buf[0] != '*') {
buf--;
}
if (sscanf(buf, "* %lu EXISTS\r\n", &messages) == 1) {
timed_thread_lock(mail->p_timed_thread);
mail->messages = messages;
timed_thread_unlock(mail->p_timed_thread);
}
}
buf = strstr(buf, "RECENT");
if (buf) {
// back up until we reach '*'
while (buf >= recvbuf && buf[0] != '*') {
buf--;
}
if (sscanf(buf, "* %lu RECENT\r\n", &unseen) == 1) {
timed_thread_lock(mail->p_timed_thread);
mail->unseen = unseen;
timed_thread_unlock(mail->p_timed_thread);
}
}
}
if (strlen(mail->command) > 1 && (mail->unseen > old_unseen
|| (mail->messages > old_messages && mail->unseen > 0))) {
// new mail goodie
if (system(mail->command) == -1) {
perror("system()");
}
}
fail = 0;
old_unseen = mail->unseen;
old_messages = mail->messages;
}
} else {
strncpy(sendbuf, "a3 logout\r\n", MAXDATASIZE);
if (send(sockfd, sendbuf, strlen(sendbuf), 0) == -1) {
perror("send a3");
@ -1801,16 +1952,7 @@ void *imap_thread(void *arg)
fail++;
break;
}
if (strlen(mail->command) > 1 && (mail->unseen > old_unseen
|| (mail->messages > old_messages && mail->unseen > 0))) {
// new mail goodie
if (system(mail->command) == -1) {
perror("system()");
}
}
fail = 0;
old_unseen = mail->unseen;
old_messages = mail->messages;
} while (0);
if ((fstat(sockfd, &stat_buf) == 0) && S_ISSOCK(stat_buf.st_mode)) {
/* if a valid socket, close it */
@ -1832,7 +1974,7 @@ void *pop3_thread(void *arg)
char sendbuf[MAXDATASIZE];
char *reply;
unsigned int fail = 0;
unsigned int old_unseen = UINT_MAX;
unsigned long old_unseen = ULONG_MAX;
struct stat stat_buf;
struct hostent he, *he_res = 0;
int he_errno;
@ -2391,6 +2533,21 @@ static void free_text_objects(struct text_object_list *text_object_list, char fu
free_mpd_vars(&info.mpd);
}
break;
#endif
#ifdef MOC
case OBJ_moc_state:
case OBJ_moc_file:
case OBJ_moc_title:
case OBJ_moc_artist:
case OBJ_moc_song:
case OBJ_moc_album:
case OBJ_moc_totaltime:
case OBJ_moc_timeleft:
case OBJ_moc_curtime:
case OBJ_moc_bitrate:
case OBJ_moc_rate:
free_moc(&info.moc);
break;
#endif
case OBJ_scroll:
free(obj->data.scroll.text);
@ -3828,6 +3985,19 @@ static struct text_object *construct_text_object(const char *s,
obj->data.i = 0;
}
#endif /* MPD */
#ifdef MOC
END OBJ_THREAD(moc_state, INFO_MOC)
END OBJ_THREAD(moc_file, INFO_MOC)
END OBJ_THREAD(moc_title, INFO_MOC)
END OBJ_THREAD(moc_artist, INFO_MOC)
END OBJ_THREAD(moc_song, INFO_MOC)
END OBJ_THREAD(moc_album, INFO_MOC)
END OBJ_THREAD(moc_totaltime, INFO_MOC)
END OBJ_THREAD(moc_timeleft, INFO_MOC)
END OBJ_THREAD(moc_curtime, INFO_MOC)
END OBJ_THREAD(moc_bitrate, INFO_MOC)
END OBJ_THREAD(moc_rate, INFO_MOC)
#endif /* MOC */
#ifdef XMMS2
END OBJ(xmms2_artist, INFO_XMMS2)
END OBJ(xmms2_album, INFO_XMMS2)
@ -4030,11 +4200,12 @@ static struct text_object *construct_text_object(const char *s,
END OBJ(scroll, 0)
int n;
if (arg && sscanf(arg, "%u %n", &obj->data.scroll.show, &n) > 0) {
obj->data.scroll.step = 1;
if (arg && sscanf(arg, "%u %u %n", &obj->data.scroll.show, &obj->data.scroll.step, &n) > 0) {
obj->data.scroll.text = strndup(arg + n, text_buffer_size);
obj->data.scroll.start = 0;
} else {
CRIT_ERR("scroll needs arguments: <length> <text>");
CRIT_ERR("scroll needs arguments: <length> [<step>] <text>");
}
#ifdef NVIDIA
END OBJ(nvidia, 0)
@ -5771,6 +5942,41 @@ static void generate_text_internal(char *p, int p_max_size,
}
#endif
#ifdef MOC
OBJ(moc_state) {
snprintf(p, p_max_size, "%s", (cur->moc.state ? cur->moc.state : "??"));
}
OBJ(moc_file) {
snprintf(p, p_max_size, "%s", (cur->moc.file ? cur->moc.file : "no file"));
}
OBJ(moc_title) {
snprintf(p, p_max_size, "%s", (cur->moc.title ? cur->moc.title : "no title"));
}
OBJ(moc_artist) {
snprintf(p, p_max_size, "%s", (cur->moc.artist ? cur->moc.artist : "no artist"));
}
OBJ(moc_song) {
snprintf(p, p_max_size, "%s", (cur->moc.song ? cur->moc.song : "no song"));
}
OBJ(moc_album) {
snprintf(p, p_max_size, "%s", (cur->moc.album ? cur->moc.album : "no album"));
}
OBJ(moc_totaltime) {
snprintf(p, p_max_size, "%s", (cur->moc.totaltime ? cur->moc.totaltime : "0:00"));
}
OBJ(moc_timeleft) {
snprintf(p, p_max_size, "%s", (cur->moc.timeleft ? cur->moc.timeleft : "0:00"));
}
OBJ(moc_curtime) {
snprintf(p, p_max_size, "%s", (cur->moc.curtime ? cur->moc.curtime : "0:00"));
}
OBJ(moc_bitrate) {
snprintf(p, p_max_size, "%s", (cur->moc.bitrate ? cur->moc.bitrate : "0Kbps"));
}
OBJ(moc_rate) {
snprintf(p, p_max_size, "%s", (cur->moc.rate ? cur->moc.rate : "0KHz"));
}
#endif /* MOC */
#ifdef XMMS2
OBJ(xmms2_artist) {
snprintf(p, p_max_size, "%s", cur->xmms2.artist);
@ -6300,6 +6506,10 @@ head:
unsigned int j;
char *tmp;
parse_conky_vars(obj->data.scroll.text, p, cur);
if (strlen(p) <= obj->data.scroll.show) {
break;
}
#define LINESEPARATOR '|'
//place all the lines behind each other with LINESEPARATOR between them
for(j = 0; p[j] != 0; j++) {
@ -6322,8 +6532,8 @@ head:
p[obj->data.scroll.show] = 0;
}
//next time, scroll a place more or reset scrolling if we are at the end
obj->data.scroll.start++;
if(obj->data.scroll.start == j){
obj->data.scroll.start += obj->data.scroll.step;
if(obj->data.scroll.start >= j){
obj->data.scroll.start = 0;
}
}
@ -7359,7 +7569,7 @@ static void update_text(void)
static void main_loop(void)
{
#ifdef SIGNAL_BLOCKING
sigset_t newmask, oldmask;
sigset_t newmask;
#endif
double t;
#ifdef X11
@ -7751,6 +7961,10 @@ void reload_config(void)
}
#endif
#ifdef MOC
free_moc(&info.moc);
#endif
#ifdef X11
free_fonts();
#endif /* X11 */
@ -7799,6 +8013,7 @@ void reload_config(void)
memset(text_buffer, 0, max_user_text);
update_text();
}
sigemptyset(&oldmask);
}
void clean_up(void)
@ -7958,6 +8173,9 @@ static void set_default_configurations(void)
info.mpd.name = NULL;
info.mpd.file = NULL;
#endif
#ifdef MOC
init_moc(&info.moc);
#endif
#ifdef XMMS2
info.xmms2.artist = NULL;
info.xmms2.album = NULL;
@ -8794,6 +9012,7 @@ int main(int argc, char **argv)
g_signal_pending = 0;
memset(&info, 0, sizeof(info));
clear_net_stats();
#ifdef TCP_PORT_MONITOR
tcp_port_monitor_args.max_port_monitor_connections =
@ -9084,16 +9303,13 @@ int main(int argc, char **argv)
act.sa_flags |= SA_RESTART;
#endif
if (sigaction(SIGINT, &act, &oact) < 0
if ( sigaction(SIGINT, &act, &oact) < 0
|| sigaction(SIGUSR1, &act, &oact) < 0
|| sigaction(SIGHUP,&act,&oact) < 0
|| sigaction(SIGHUP, &act, &oact) < 0
|| sigaction(SIGTERM, &act, &oact) < 0) {
ERR("error setting signal handler: %s", strerror(errno));
}
/* *************** *
* MAIN CONKY LOOP *
* *************** */
main_loop();
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)

View File

@ -178,6 +178,10 @@ struct mail_s { // for imap and pop3
#include "mpd.h"
#endif
#ifdef MOC
#include "moc.h"
#endif
#ifdef XMMS2
#include "xmms2.h"
#endif
@ -273,8 +277,10 @@ enum {
#ifdef X11
INFO_X11 = 29,
#endif
INFO_DNS = 30
INFO_DNS = 30,
#ifdef MOC
INFO_MOC = 31
#endif
};
/* get_battery_stuff() item selector */
@ -325,6 +331,9 @@ struct information {
#ifdef MPD
struct mpd_s mpd;
#endif
#ifdef MOC
struct moc_s moc;
#endif
#ifdef XMMS2
struct xmms2_s xmms2;
int xmms2_conn_state;