Initial import of the ircii-pana-1.1-final source tree.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/tags/ircii-pana-1.1-final@1 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
182
dll/xmms/Makefile.in
Normal file
182
dll/xmms/Makefile.in
Normal file
@@ -0,0 +1,182 @@
|
||||
# dll/xmms/Makefile
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
topdir = @topdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = @oldincludedir@
|
||||
|
||||
local_dir = $(HOME)
|
||||
|
||||
# Where the BitchX binary will be installed.
|
||||
# "make install" will compile and install the program.
|
||||
INSTALL_IRC = @INSTALL_IRC@
|
||||
|
||||
# Where the BitchX library will be. Generally this is the place that
|
||||
# you put the scripts, help pages and translation tables. It is
|
||||
# very important that you set this correctly.
|
||||
IRCLIB = @IRCLIB@
|
||||
|
||||
CC = @CC@
|
||||
DEFS = @INCLUDES@
|
||||
LIBS = @LIBS@
|
||||
|
||||
# Tcl library.
|
||||
TCL_LIBS = @TCL_LIBS@
|
||||
|
||||
# These are for Tcl support.
|
||||
TCL_OBJS = @TCL_OBJS@
|
||||
# You don't have the following, so you'll want to leave this blank.
|
||||
TCL_SRCS = @TCL_SRCS@
|
||||
|
||||
# Set this to -g if you want to be able to debug the client, otherwise
|
||||
# use -O to have the compiler do some optimization instead.
|
||||
CFLAGS = @CFLAGS@
|
||||
|
||||
# Set this to -s if you want the binary to be stripped.
|
||||
LDFLAGS = @LDFLAGS@
|
||||
|
||||
# These are for the cd device player.
|
||||
CD_SRCS = @CD_SRCS@
|
||||
CD_OBJS = @CD_OBJS@
|
||||
|
||||
# This is the executable suffix for the target operating system.
|
||||
EXEEXT = @EXEEXT@
|
||||
|
||||
# Extra files.
|
||||
DEFAULT_CTOOLZ_DIR = @DEFAULT_CTOOLZ_DIR@
|
||||
DEFAULT_MSGLOGFILE = @DEFAULT_MSGLOGFILE@
|
||||
DEFAULT_BITCHX_HELP_FILE = @DEFAULT_BITCHX_HELP_FILE@
|
||||
DEFAULT_SCRIPT_HELP_FILE = @DEFAULT_SCRIPT_HELP_FILE@
|
||||
DEFAULT_BITCHX_KICK_FILE = @DEFAULT_BITCHX_KICK_FILE@
|
||||
DEFAULT_BITCHX_QUIT_FILE = @DEFAULT_BITCHX_QUIT_FILE@
|
||||
DEFAULT_BITCHX_IRCNAME_FILE = @DEFAULT_BITCHX_IRCNAME_FILE@
|
||||
|
||||
# Full path of the directory for BitchX help files.
|
||||
HELPDIR = @HELPDIR@
|
||||
|
||||
# Full path of the directory for the BitchX scripts.
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
|
||||
# Default setting for IRCPATH where BitchX will look for
|
||||
# its script files if the environment variable is undefined.
|
||||
# Usually, this should contain the same path as used for INSTALL_SCRIPT in
|
||||
# the Makefile, but it can contain multiple path elements
|
||||
# separated by colons. The path MUST lead to an existing directory,
|
||||
# because the 'global' script is expected to be found there.
|
||||
IRCPATH = @IRCPATH@
|
||||
|
||||
# Path for TRANSLATION variable.
|
||||
TRANSLATION_PATH = @TRANSLATION_PATH@
|
||||
|
||||
# This command will be used to install the BitchX help files. If you don't
|
||||
# want to install them, replace with the following:
|
||||
# INSTALL_HELP_CMD = @echo The help files have not been installed.
|
||||
INSTALL_HELP_CMD = @INSTALL_HELP_CMD@
|
||||
|
||||
# This is where the optional plugins will be copied to.
|
||||
PLUGINDIR = @PLUGINDIR@
|
||||
|
||||
# Plugin flags.
|
||||
SHLIB_LD = @SHLIB_LD@
|
||||
SHLIB_CFLAGS = @SHLIB_CFLAGS@
|
||||
SHLIB_SUFFIX = @SHLIB_SUFFIX@
|
||||
|
||||
# This command will be used to install the BitchX files on Win32/OS2EMX
|
||||
# systems.
|
||||
WINNT_INSTALL = @WINNT_INSTALL@
|
||||
|
||||
# This program allows you to use screen/xterm's to put new BitchX windows
|
||||
# on new screen/xterm windows.
|
||||
INSTALL_WSERV = @INSTALL_WSERV@
|
||||
|
||||
# This program allows you to screen BitchX and reattach to it later.
|
||||
INSTALL_SCRBX = @INSTALL_SCRBX@
|
||||
|
||||
# Set gzip and bzip2 options.
|
||||
GZIP_ENV = @GZIP_ENV@
|
||||
BZIP2 = @BZIP2@
|
||||
|
||||
# Standard programs.
|
||||
RM = @RM@
|
||||
LN = @LN_S@
|
||||
CP = @CP@
|
||||
MV = @MV@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
VERSION = @VERSION@
|
||||
_VERSION_ = @_VERSION_@
|
||||
|
||||
MAKE_BIN = @MAKE@
|
||||
MAKE = $(MAKE_BIN) $(MFLAGS)
|
||||
MFLAGS = \
|
||||
'local_dir=$(HOME)' \
|
||||
'INSTALL_IRC=$(INSTALL_IRC)' \
|
||||
'IRCLIB=$(IRCLIB)' \
|
||||
'CC=$(CC)' \
|
||||
'CFLAGS=$(CFLAGS)' \
|
||||
'HELPDIR=$(HELPDIR)' \
|
||||
'INSTALL_WSERV=$(INSTALL_WSERV)' \
|
||||
'IRCPATH=$(IRCPATH)' \
|
||||
'TRANSLATION_PATH=$(TRANSLATION_PATH)' \
|
||||
'LDFLAGS=$(LDFLAGS)' \
|
||||
'LIBS=$(LIBS)' \
|
||||
'LN=$(LN)' \
|
||||
'RM=$(RM)' \
|
||||
'TCL_SRCS=$(TCL_SRCS)' \
|
||||
'TCL_OBJS=$(TCL_OBJS)' \
|
||||
'CD_PLAY=$(CD_PLAY)' \
|
||||
'CD_SRCS=$(CD_SRCS)' \
|
||||
'CD_OBJS=$(CD_OBJS)' \
|
||||
'TCL_LIBS=$(TCL_LIBS)' \
|
||||
'PLUGINDIR=$(PLUGINDIR)' \
|
||||
'_VERSION_=$(_VERSION_)' \
|
||||
'VERSION=$(VERSION)' \
|
||||
'INSTALL_DATA=$(INSTALL_DATA)' \
|
||||
'INSTALL_SCRIPT=$(INSTALL_SCRIPT)' \
|
||||
'EXEEXT=$(EXEEXT)' \
|
||||
'SHLIB_CFLAGS=$(SHLIB_CFLAGS)' \
|
||||
'SHLIB_SUFFIX=$(SHLIB_SUFFIX)'
|
||||
|
||||
## Makefile starts here.
|
||||
|
||||
PLUGIN_NAME = xmms
|
||||
|
||||
all: Makefile xmms$(SHLIB_SUFFIX)
|
||||
|
||||
Makefile: Makefile.in
|
||||
cd $(topdir) \
|
||||
&& ./config.status
|
||||
|
||||
xmms.o: $(srcdir)/xmms.c
|
||||
$(CC) $(DEFS) $(CFLAGS) `xmms-config --cflags` -c $(srcdir)/xmms.c
|
||||
|
||||
xmms$(SHLIB_SUFFIX): xmms.o ../dllinit.o
|
||||
$(SHLIB_LD) xmms.o ../dllinit.o $(SHLIB_CFLAGS) -o xmms$(SHLIB_SUFFIX) `xmms-config --libs`
|
||||
|
||||
clean:
|
||||
$(RM) *~ *.o *.a *.dll xmms$(SHLIB_SUFFIX) *.def .#*
|
||||
|
||||
distclean: clean
|
||||
$(RM) Makefile
|
||||
|
||||
install: all
|
||||
$(INSTALL) $(PLUGIN_NAME)$(SHLIB_SUFFIX) $(PLUGINDIR)
|
||||
327
dll/xmms/xmms.c
Normal file
327
dll/xmms/xmms.c
Normal file
@@ -0,0 +1,327 @@
|
||||
#if !defined(WINNT) && !defined(EMX)
|
||||
/*
|
||||
* xmms.c: This file handles all the XMMS routines, in BitchX
|
||||
*
|
||||
* Written by Andr<64> Camargo
|
||||
* based on the code of Tom Zickel a.k.a. IceBreak on the IRC
|
||||
* and Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson and
|
||||
* 4Front Technologies
|
||||
*
|
||||
* Copyleft (1999) "CASSIUS IN THE HOUSE!" :)
|
||||
*
|
||||
* BitchX plugin v0.01 by DavidW2
|
||||
* BitchX plugin v1.00 by caf
|
||||
*/
|
||||
|
||||
#include "irc.h"
|
||||
#include "struct.h"
|
||||
#include "server.h"
|
||||
#include "ircaux.h"
|
||||
#include "output.h"
|
||||
#include "misc.h"
|
||||
#include "vars.h"
|
||||
#include "status.h"
|
||||
#include "hook.h"
|
||||
#include "module.h"
|
||||
#include "ctcp.h"
|
||||
#ifndef INIT_MODULE
|
||||
#define INIT_MODULE
|
||||
#endif
|
||||
#include "modval.h"
|
||||
|
||||
#include <xmms/xmmsctrl.h>
|
||||
|
||||
#define MODULE_NAME "Xmms"
|
||||
#define _MODULE_VERSION "1.00"
|
||||
|
||||
static int check_xmms(void);
|
||||
|
||||
static char xmms_format[] = "%K[%G" MODULE_NAME " %g" _MODULE_VERSION
|
||||
"%K] %n$*";
|
||||
static char xmms_format2[] = "%K[%G" MODULE_NAME " %g" _MODULE_VERSION
|
||||
" %K|%B $0 %K] %n$1-";
|
||||
static char xmms_format_vol[] = "%K[%G" MODULE_NAME " %g" _MODULE_VERSION
|
||||
" %K|%B $0 %K|%W$[10]1%K] %n$2%%";
|
||||
static char xmms_format_track[] = "%K[%G" MODULE_NAME " %g" _MODULE_VERSION
|
||||
" %K|%B $0 %K|%W$[-4]1%n/%W$[-4]2%K] %n$3-";
|
||||
|
||||
static char xmms_volbar[] = "==========";
|
||||
#define VOLBAR(n) ((n)>9?(xmms_volbar + 10 - (n)/10):".")
|
||||
|
||||
static int xmms_session = 0;
|
||||
|
||||
BUILT_IN_DLL(xmms_cmd)
|
||||
{
|
||||
char *arg;
|
||||
arg = next_arg(args, &args);
|
||||
|
||||
if (!arg)
|
||||
arg = "HELP";
|
||||
|
||||
if (*arg == '-' || *arg == '/')
|
||||
arg++;
|
||||
|
||||
if (!my_stricmp(arg, "PLAY"))
|
||||
{
|
||||
if (check_xmms())
|
||||
{
|
||||
if ((arg = next_arg(args, &args)))
|
||||
if (atoi(arg) < xmms_remote_get_playlist_length(xmms_session))
|
||||
xmms_remote_set_playlist_pos(xmms_session, atoi(args));
|
||||
xmms_remote_play(xmms_session);
|
||||
}
|
||||
}
|
||||
else if (!my_stricmp(arg, "PAUSE"))
|
||||
{
|
||||
if (check_xmms())
|
||||
{
|
||||
if (!xmms_remote_is_paused(xmms_session))
|
||||
xmms_remote_pause(xmms_session);
|
||||
}
|
||||
}
|
||||
else if (!my_stricmp(arg, "NEXT"))
|
||||
{
|
||||
if (check_xmms())
|
||||
xmms_remote_playlist_next(xmms_session);
|
||||
}
|
||||
else if (!my_stricmp(arg, "PREV"))
|
||||
{
|
||||
if (check_xmms())
|
||||
xmms_remote_playlist_prev(xmms_session);
|
||||
}
|
||||
else if (!my_stricmp(arg, "STOP"))
|
||||
{
|
||||
if (check_xmms())
|
||||
xmms_remote_stop(xmms_session);
|
||||
}
|
||||
else if (!my_stricmp(arg, "LIST"))
|
||||
{
|
||||
int i;
|
||||
|
||||
if (check_xmms())
|
||||
{
|
||||
char *title;
|
||||
int pl_len = xmms_remote_get_playlist_length(xmms_session);
|
||||
for (i = 0; i < pl_len; i++) {
|
||||
title = xmms_remote_get_playlist_title(xmms_session, i);
|
||||
put_it("%s", convert_output_format(xmms_format_track,
|
||||
"playlist %d %d %s", i + 1, pl_len, title));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!my_stricmp(arg, "VOL"))
|
||||
{
|
||||
int v;
|
||||
|
||||
if (check_xmms())
|
||||
{
|
||||
if ((arg = next_arg(args, &args)))
|
||||
{
|
||||
v = atoi(arg);
|
||||
if (v > 100)
|
||||
v = 100;
|
||||
if (v < 0)
|
||||
v = 0;
|
||||
xmms_remote_set_main_volume(xmms_session, v);
|
||||
} else {
|
||||
v = xmms_remote_get_main_volume(xmms_session);
|
||||
}
|
||||
put_it("%s", convert_output_format(xmms_format_vol,
|
||||
"volume %s %d", VOLBAR(v), v));
|
||||
}
|
||||
}
|
||||
else if (!my_stricmp(arg, "VOLUP"))
|
||||
{
|
||||
int vol;
|
||||
if (check_xmms())
|
||||
{
|
||||
vol = xmms_remote_get_main_volume(xmms_session) + 10;
|
||||
if (vol > 100)
|
||||
vol = 100;
|
||||
xmms_remote_set_main_volume(xmms_session, vol);
|
||||
put_it("%s", convert_output_format(xmms_format_vol,
|
||||
"volume %s %d", VOLBAR(vol), vol));
|
||||
}
|
||||
}
|
||||
else if (!my_stricmp(arg, "VOLDOWN"))
|
||||
{
|
||||
int vol;
|
||||
if (check_xmms())
|
||||
{
|
||||
vol = xmms_remote_get_main_volume(xmms_session) - 10;
|
||||
if (vol < 0)
|
||||
vol = 0;
|
||||
xmms_remote_set_main_volume(xmms_session, vol);
|
||||
put_it("%s", convert_output_format(xmms_format_vol,
|
||||
"volume %s %d", VOLBAR(vol), vol));
|
||||
}
|
||||
}
|
||||
else if (!my_stricmp(arg, "BALANCE"))
|
||||
{
|
||||
int bal;
|
||||
arg = next_arg(args, &args);
|
||||
|
||||
if (arg && check_xmms()) {
|
||||
bal = atoi(arg);
|
||||
if (bal > 100)
|
||||
bal = 100;
|
||||
if (bal < -100)
|
||||
bal = -100;
|
||||
xmms_remote_set_balance(xmms_session, bal);
|
||||
}
|
||||
}
|
||||
else if (!my_stricmp(arg, "TOGSHUFFLE"))
|
||||
{
|
||||
if (check_xmms())
|
||||
xmms_remote_toggle_shuffle(xmms_session);
|
||||
}
|
||||
else if (!my_stricmp(arg, "TOGREPEAT"))
|
||||
{
|
||||
if (check_xmms())
|
||||
xmms_remote_toggle_repeat(xmms_session);
|
||||
}
|
||||
else if (!my_stricmp(arg, "HELP"))
|
||||
{
|
||||
put_it("%s", convert_output_format(xmms_format, "%s",
|
||||
"Usage: /XMMS <command>"));
|
||||
put_it(" - PLAY Play a song");
|
||||
put_it(" - PAUSE Pause/resume the playing song");
|
||||
put_it(" - STOP Stop the playing song");
|
||||
put_it(" - NEXT Scream to XMMS: next song!");
|
||||
put_it(" - PREV "
|
||||
"Change to previous song in XMMS playlist");
|
||||
put_it(" - VOL "
|
||||
"Set's the XMMS Volume (range from 0%% to 100%%)");
|
||||
put_it(" - VOLUP Increase volume +10");
|
||||
put_it(" - VOLDOWN Decrease volume -10");
|
||||
put_it(" - BALANCE "
|
||||
"Set balance, -100 (full left) to 100 (full right)");
|
||||
put_it(" - TOGREPEAT Toggle repeat");
|
||||
put_it(" - TOGSHUFFLE Toggle shuffle");
|
||||
put_it(" - LIST Show XMMS playlist songs");
|
||||
put_it(" - INFO "
|
||||
"Show what song is selected in the playlist");
|
||||
put_it(" - INFOCHANNEL "
|
||||
"Spam the current channel with the song you're "
|
||||
"listening to");
|
||||
put_it(" - SETTIME "
|
||||
"Jump to position in song (percentage)");
|
||||
put_it(" - QUIT Close XMMS");
|
||||
}
|
||||
else if (!my_stricmp(arg, "INFO"))
|
||||
{
|
||||
char *title;
|
||||
int pl_len, pl_pos;
|
||||
|
||||
if (check_xmms()) {
|
||||
pl_len = xmms_remote_get_playlist_length(xmms_session);
|
||||
if (pl_len) {
|
||||
pl_pos = xmms_remote_get_playlist_pos(xmms_session);
|
||||
title = xmms_remote_get_playlist_title(xmms_session, pl_pos);
|
||||
put_it("%s", convert_output_format(xmms_format_track,
|
||||
"track %d %d %s", pl_pos + 1, pl_len,
|
||||
title));
|
||||
} else {
|
||||
put_it("%s", convert_output_format(xmms_format2,
|
||||
"track (playlist empty)"));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!my_stricmp(arg, "QUIT"))
|
||||
{
|
||||
if (check_xmms())
|
||||
xmms_remote_quit(xmms_session);
|
||||
}
|
||||
else if (!my_stricmp(arg, "SETTIME"))
|
||||
{
|
||||
int pl_pos;
|
||||
int full_time;
|
||||
int set_time;
|
||||
arg = next_arg(args, &args);
|
||||
|
||||
if (arg && check_xmms())
|
||||
{
|
||||
pl_pos = xmms_remote_get_playlist_pos(xmms_session);
|
||||
full_time = xmms_remote_get_playlist_time(xmms_session,
|
||||
pl_pos);
|
||||
set_time = atoi(arg);
|
||||
if (set_time < 0)
|
||||
set_time = 0;
|
||||
if (set_time > 100)
|
||||
set_time = 100;
|
||||
|
||||
xmms_remote_jump_to_time(xmms_session,
|
||||
set_time * full_time / 100);
|
||||
}
|
||||
}
|
||||
else if (!my_stricmp(arg, "INFOCHANNEL"))
|
||||
{
|
||||
if (check_xmms())
|
||||
{
|
||||
char *target;
|
||||
char *title;
|
||||
int pl_pos = xmms_remote_get_playlist_pos(xmms_session);
|
||||
int pl_len = xmms_remote_get_playlist_length(xmms_session);
|
||||
target = get_current_channel_by_refnum(0);
|
||||
if (pl_len && target)
|
||||
{
|
||||
char message[512];
|
||||
char putbuf[IRCD_BUFFER_SIZE];
|
||||
|
||||
title = xmms_remote_get_playlist_title(xmms_session, pl_pos);
|
||||
sprintf(message,
|
||||
"[XMMS Playing: %s]",
|
||||
title);
|
||||
|
||||
set_display_target(target, LOG_ACTION);
|
||||
|
||||
do_hook(SEND_CTCP_LIST, "PRIVMSG %s ACTION %s",
|
||||
target, message);
|
||||
sprintf(putbuf, "%cACTION %s%c",
|
||||
CTCP_DELIM_CHAR, message,
|
||||
CTCP_DELIM_CHAR);
|
||||
send_text(target, putbuf, "PRIVMSG", 0, 0);
|
||||
|
||||
if (do_hook(SEND_ACTION_LIST, "%s %s", target, message))
|
||||
{
|
||||
if (strchr("&#", *target))
|
||||
put_it("%s", convert_output_format(fget_string_var(FORMAT_SEND_ACTION_FSET), "%s %s %s %s", update_clock(GET_TIME), get_server_nickname(from_server), target, message));
|
||||
else
|
||||
put_it("%s", convert_output_format(fget_string_var(FORMAT_SEND_ACTION_OTHER_FSET), "%s %s %s %s", update_clock(GET_TIME), get_server_nickname(from_server), target, message));
|
||||
}
|
||||
reset_display_target();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int check_xmms(void)
|
||||
{
|
||||
int xmms_running = xmms_remote_is_running(xmms_session);
|
||||
|
||||
if (!xmms_running)
|
||||
{
|
||||
put_it("%s", convert_output_format(xmms_format, "%s",
|
||||
"Could not find a running instance of XMMS."));
|
||||
}
|
||||
return xmms_running;
|
||||
}
|
||||
|
||||
int Xmms_Cleanup(IrcCommandDll **interp, Function_ptr *global_table)
|
||||
{
|
||||
remove_module_proc(COMMAND_PROC, MODULE_NAME, NULL, NULL);
|
||||
put_it("%s", convert_output_format(xmms_format, "%s",
|
||||
"by Andr<64> Camargo, DavidW2 and caf unloaded."));
|
||||
return 2;
|
||||
}
|
||||
|
||||
int Xmms_Init(IrcCommandDll **interp, Function_ptr *global_table)
|
||||
{
|
||||
initialize_module(MODULE_NAME);
|
||||
add_module_proc(COMMAND_PROC, "Xmms", "Xmms", NULL, 0, 0, xmms_cmd, empty_string);
|
||||
put_it("%s", convert_output_format(xmms_format, "%s",
|
||||
"by Andr<64> Camargo, DavidW2 and caf loaded. "
|
||||
"Type /XMMS for command help."));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user