/*** received_signal ***/
void received_signal(int signal) {
	GError * error = NULL;

	switch (signal) {
		case SIGINT:
		case SIGTERM:
			if (verbose > 0)
				printf("Received signal %s, preparing exit.\n", strsignal(signal));

			doexit++;
			mpd_send_noidle(conn);
			break;

		case SIGHUP:
		case SIGUSR1:
			if (verbose > 0)
				printf("Received signal %s, showing last notification again.\n", strsignal(signal));

			if (notify_notification_show(notification, &error) == FALSE) {
				g_printerr("%s: Error \"%s\" while trying to show notification again.\n", program, error->message);
				g_error_free(error);
			}
			break;
		default:
			fprintf(stderr, "Reveived signal %s (%d), no idea what to do...\n", strsignal(signal), signal);
	}
}
Example #2
0
/**
 * Take client out of IDLE mode
 */
bool
Control::noidle()
{
	if (!is_idle()) {
		return true;
	}

	pms->log(MSG_DEBUG, 0, "Leaving IDLE mode.\n");
	set_is_idle(mpd_send_noidle(conn->h()));

	return is_idle();
}
Example #3
0
int Connection::noidle()
{
	checkConnection();
	int flags = 0;
	if (m_idle && mpd_send_noidle(m_connection.get()))
	{
		m_idle = false;
		flags = mpd_recv_idle(m_connection.get(), true);
		mpd_response_finish(m_connection.get());
		checkErrors();
	}
	return flags;
}