Perl works again :) Split to Irssi and Irssi::Irc packages.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@705 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-10-01 20:48:48 +00:00 committed by cras
commit 62dee8fdaf
20 changed files with 904 additions and 23 deletions

7
src/perl/irc/.cvsignore Normal file
View file

@ -0,0 +1,7 @@
Makefile
Makefile.PL
Irc.c
Irc.bs
*.o
pm_to_blib
blib

40
src/perl/irc/Bans.xs Normal file
View file

@ -0,0 +1,40 @@
MODULE = Irssi::Irc PACKAGE = Irssi::Irc
void
ban_set_type(type)
char *type
#*******************************
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Channel
#*******************************
char *
ban_get_mask(channel, nick)
Irssi::Irc::Channel channel
char *nick
void
ban_set(channel, bans)
Irssi::Irc::Channel channel
char *bans
void
ban_remove(channel, ban)
Irssi::Irc::Channel channel
char *ban
#*******************************
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Ban
#*******************************
void
values(ban)
Irssi::Irc::Ban ban
PREINIT:
HV *hv;
PPCODE:
hv = newHV();
hv_store(hv, "ban", 3, new_pv(ban->ban), 0);
hv_store(hv, "setby", 5, new_pv(ban->setby), 0);
hv_store(hv, "time", 4, newSViv(ban->time), 0);
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));

81
src/perl/irc/Dcc.xs Normal file
View file

@ -0,0 +1,81 @@
MODULE = Irssi::Irc PACKAGE = Irssi::Irc
void
dccs()
PREINIT:
GSList *tmp;
HV *stash;
PPCODE:
stash = gv_stashpv("Irssi::Irc::Dcc", 0);
for (tmp = dcc_conns; tmp != NULL; tmp = tmp->next) {
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
}
Irssi::Irc::Dcc
dcc_find_item(type, nick, arg)
int type
char *nick
char *arg
Irssi::Irc::Dcc
dcc_find_by_port(nick, port)
char *nick
int port
void
dcc_ctcp_message(target, server, chat, notice, msg)
char *target
Irssi::Irc::Server server
Irssi::Irc::Dcc chat
int notice
char *msg
Irssi::Irc::Dcc
item_get_dcc(item)
void *item
#*******************************
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Dcc PREFIX = dcc_
#*******************************
void
dcc_destroy(dcc)
Irssi::Irc::Dcc dcc
void
dcc_chat_send(dcc, data)
Irssi::Irc::Dcc dcc
char *data
void
values(dcc)
Irssi::Irc::Dcc dcc
PREINIT:
HV *hv, *stash;
PPCODE:
hv = newHV();
hv_store(hv, "type", 4, new_pv((char *) dcc_type2str(dcc->type)), 0);
hv_store(hv, "created", 7, newSViv(dcc->created), 0);
hv_store(hv, "server", 6, sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(dcc->server))),
irssi_get_stash(dcc->server)), 0);
hv_store(hv, "nick", 4, new_pv(dcc->nick), 0);
stash = gv_stashpv("Irssi::Irc::Dcc", 0);
hv_store(hv, "chat", 4, sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(dcc->chat))), stash), 0);
hv_store(hv, "ircnet", 6, new_pv(dcc->ircnet), 0);
hv_store(hv, "mynick", 6, new_pv(dcc->mynick), 0);
hv_store(hv, "arg", 3, new_pv(dcc->arg), 0);
hv_store(hv, "file", 4, new_pv(dcc->file), 0);
hv_store(hv, "addr", 4, new_pv(dcc->addrstr), 0);
hv_store(hv, "port", 4, newSViv(dcc->port), 0);
hv_store(hv, "size", 4, newSViv(dcc->size), 0);
hv_store(hv, "transfd", 7, newSViv(dcc->transfd), 0);
hv_store(hv, "skipped", 7, newSViv(dcc->skipped), 0);
hv_store(hv, "starttime", 9, newSViv(dcc->starttime), 0);
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));

29
src/perl/irc/Flood.xs Normal file
View file

@ -0,0 +1,29 @@
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Server
void
autoignore_add(server, nick, level)
Irssi::Irc::Server server
char *nick
int level
int
autoignore_remove(server, mask, level)
Irssi::Irc::Server server
char *mask
int level
#*******************************
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Autoignore
#*******************************
void
values(ai)
Irssi::Irc::Autoignore ai
PREINIT:
HV *hv;
PPCODE:
hv = newHV();
hv_store(hv, "nick", 4, new_pv(ai->nick), 0);
hv_store(hv, "timeleft", 8, newSViv(ai->timeleft), 0);
hv_store(hv, "level", 5, newSViv(ai->level), 0);
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));

74
src/perl/irc/Ignore.xs Normal file
View file

@ -0,0 +1,74 @@
MODULE = Irssi::Irc PACKAGE = Irssi::Irc
void
ignores()
PREINIT:
GSList *tmp;
HV *stash;
PPCODE:
stash = gv_stashpv("Irssi::Irc::Ignore", 0);
for (tmp = servers; tmp != NULL; tmp = tmp->next) {
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
}
int
ignore_check(nick, host, channel, text, level)
char *nick
char *host
char *channel
char *text
int level
CODE:
RETVAL = ignore_check(NULL, nick, host, channel, text, level);
OUTPUT:
RETVAL
#*******************************
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Server
#*******************************
int
ignore_check(server, nick, host, channel, text, level)
Irssi::Irc::Server server
char *nick
char *host
char *channel
char *text
int level
#*******************************
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Ignore PREFIX = ignore_
#*******************************
void
values(ignore)
Irssi::Irc::Ignore ignore
PREINIT:
HV *hv;
AV *av;
char **tmp;
PPCODE:
hv = newHV();
hv_store(hv, "mask", 4, new_pv(ignore->mask), 0);
hv_store(hv, "servertag", 9, new_pv(ignore->servertag), 0);
av = newAV();
for (tmp = ignore->channels; *tmp != NULL; tmp++) {
av_push(av, new_pv(*tmp));
}
hv_store(hv, "channels", 8, newRV_noinc((SV*)av), 0);
hv_store(hv, "pattern", 7, new_pv(ignore->pattern), 0);
hv_store(hv, "level", 5, newSViv(ignore->level), 0);
hv_store(hv, "except_level", 12, newSViv(ignore->except_level), 0);
hv_store(hv, "regexp", 6, newSViv(ignore->regexp), 0);
hv_store(hv, "fullword", 8, newSViv(ignore->fullword), 0);
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
void
ignore_add_rec(rec)
Irssi::Irc::Ignore rec
void
ignore_update_rec(rec)
Irssi::Irc::Ignore rec

29
src/perl/irc/Irc.pm Normal file
View file

@ -0,0 +1,29 @@
#
# Perl interface to irssi functions.
#
package Irssi::Irc;
use strict;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
$VERSION = "0.20";
require Exporter;
require DynaLoader;
@ISA = qw(Exporter DynaLoader);
@EXPORT = qw();
@EXPORT_OK = qw();
bootstrap Irssi::Irc $VERSION;
@Irssi::Irc::Chatnet::ISA = qw(Irssi::Chatnet);
@Irssi::Irc::Server::ISA = qw(Irssi::Server);
@Irssi::Irc::ServerConnect::ISA = qw(Irssi::ServerConnect);
@Irssi::Irc::ServerSetup::ISA = qw(Irssi::ServerSetup);
@Irssi::Irc::Channel::ISA = qw(Irssi::Channel);
@Irssi::Irc::Query::ISA = qw(Irssi::Query);
1;

17
src/perl/irc/Irc.xs Normal file
View file

@ -0,0 +1,17 @@
#include "module.h"
MODULE = Irssi::Irc PACKAGE = Irssi::Irc
PROTOTYPES: ENABLE
INCLUDE: Bans.xs
INCLUDE: Ignore.xs
INCLUDE: IrcServer.xs
INCLUDE: IrcChannel.xs
INCLUDE: IrcQuery.xs
INCLUDE: Modes.xs
INCLUDE: Netsplit.xs
INCLUDE: Dcc.xs
INCLUDE: Flood.xs
INCLUDE: Notifylist.xs

View file

@ -0,0 +1,44 @@
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Channel PREFIX = irc_channel_
void
bans(channel)
Irssi::Irc::Channel channel
PREINIT:
GSList *tmp;
HV *stash;
PPCODE:
stash = gv_stashpv("Irssi::Irc::Ban", 0);
for (tmp = channel->banlist; tmp != NULL; tmp = tmp->next) {
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
}
void
ebans(channel)
Irssi::Irc::Channel channel
PREINIT:
GSList *tmp;
HV *stash;
PPCODE:
stash = gv_stashpv("Irssi::Irc::Ban", 0);
for (tmp = channel->ebanlist; tmp != NULL; tmp = tmp->next) {
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
}
void
invites(channel)
Irssi::Irc::Channel channel
PREINIT:
GSList *tmp;
HV *stash;
PPCODE:
for (tmp = channel->invitelist; tmp != NULL; tmp = tmp->next) {
XPUSHs(new_pv(tmp->data));
}
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Server PREFIX = irc_
Irssi::Irc::Channel
irc_channel_create(server, name, automatic)
Irssi::Irc::Server server
char *name
int automatic

7
src/perl/irc/IrcQuery.xs Normal file
View file

@ -0,0 +1,7 @@
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Server PREFIX = irc_
Irssi::Irc::Query
irc_query_create(server, nick, automatic)
Irssi::Irc::Server server
char *nick
int automatic

37
src/perl/irc/IrcServer.xs Normal file
View file

@ -0,0 +1,37 @@
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Server PREFIX = irc_server_
void
values(server)
Irssi::Irc::Server server
PREINIT:
HV *hv;
PPCODE:
hv = newHV();
perl_server_fill_hash(hv, (SERVER_REC *) server);
hv_store(hv, "real_address", 12, new_pv(server->real_address), 0);
hv_store(hv, "usermode", 8, new_pv(server->usermode), 0);
hv_store(hv, "userhost", 8, new_pv(server->userhost), 0);
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
char *
irc_server_get_channels(server)
Irssi::Irc::Server server
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Connect PREFIX = irc_server_
void
values(conn)
Irssi::Irc::Connect conn
PREINIT:
HV *hv;
PPCODE:
hv = newHV();
perl_server_connect_fill_hash(hv, (SERVER_CONNECT_REC *) conn);
hv_store(hv, "alternate_nick", 14, new_pv(conn->alternate_nick), 0);
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
Irssi::Irc::Server
irc_server_connect(conn)
Irssi::Irc::Connect conn

View file

@ -0,0 +1,6 @@
use ExtUtils::MakeMaker;
WriteMakefile('NAME' => 'Irssi::Irc',
'LIBS' => '',
'INC' => '-I@top_srcdir@/src -I@top_srcdir@/src/core -I@top_srcdir@/src/irc/core -I@top_srcdir@/src/irc @GLIB_CFLAGS@',
'VERSION_FROM' => '@srcdir@/Irc.pm');

67
src/perl/irc/Modes.xs Normal file
View file

@ -0,0 +1,67 @@
MODULE = Irssi::Irc PACKAGE = Irssi::Irc
char *
modes_join(old, mode)
char *old
char *mode
#*******************************
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Server
#*******************************
void
channel_set_singlemode(server, channel, nicks, mode)
Irssi::Irc::Server server
char *channel
char *nicks
char *mode
void
channel_set_mode(server, channel, mode)
Irssi::Irc::Server server
char *channel
char *mode
#*******************************
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Channel PREFIX = channel_
#*******************************
void
parse_channel_modes(channel, setby, modestr)
Irssi::Irc::Channel channel
char *setby
char *modestr
Irssi::Irc::Ban
banlist_add(channel, ban, nick, time)
Irssi::Irc::Channel channel
char *ban
char *nick
time_t time
void
banlist_remove(channel, ban)
Irssi::Irc::Channel channel
char *ban
Irssi::Irc::Ban
banlist_exception_add(channel, ban, nick, time)
Irssi::Irc::Channel channel
char *ban
char *nick
time_t time
void
banlist_exception_remove(channel, ban)
Irssi::Irc::Channel channel
char *ban
void
invitelist_add(channel, mask)
Irssi::Irc::Channel channel
char *mask
void
invitelist_remove(channel, mask)
Irssi::Irc::Channel channel
char *mask

51
src/perl/irc/Netsplit.xs Normal file
View file

@ -0,0 +1,51 @@
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Server
Irssi::Irc::Netsplit
netsplit_find(server, nick, address)
Irssi::Irc::Server server
char *nick
char *address
Irssi::Nick
netsplit_find_channel(server, nick, address, channel)
Irssi::Irc::Server server
char *nick
char *address
char *channel
#*******************************
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Netsplit
#*******************************
void
values(netsplit)
Irssi::Irc::Netsplit netsplit
PREINIT:
HV *hv, *stash;
PPCODE:
hv = newHV();
hv_store(hv, "nick", 4, new_pv(netsplit->nick), 0);
hv_store(hv, "address", 7, new_pv(netsplit->address), 0);
hv_store(hv, "destroy", 7, newSViv(netsplit->destroy), 0);
stash = gv_stashpv("Irssi::Irc::Netsplitserver", 0);
hv_store(hv, "server", 6, sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(netsplit->server))), stash), 0);
/*FIXME: add GSList *channels;*/
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
#*******************************
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Netsplitserver
#*******************************
void
values(rec)
Irssi::Irc::Netsplitserver rec
PREINIT:
HV *hv;
PPCODE:
hv = newHV();
hv_store(hv, "server", 6, new_pv(rec->server), 0);
hv_store(hv, "destserver", 10, new_pv(rec->destserver), 0);
hv_store(hv, "count", 5, newSViv(rec->count), 0);
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));

View file

@ -0,0 +1,71 @@
MODULE = Irssi::Irc PACKAGE = Irssi::Irc
void
notifies()
PREINIT:
GSList *tmp;
HV *stash;
PPCODE:
stash = gv_stashpv("Irssi::Irc::Notifylist", 0);
for (tmp = notifies; tmp != NULL; tmp = tmp->next) {
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
}
Irssi::Irc::Notifylist
notifylist_add(mask, ircnets, away_check, idle_check_time)
char *mask
char *ircnets
int away_check
int idle_check_time
void
notifylist_remove(mask)
char *mask
Irssi::Irc::Server
notifylist_ison(nick, serverlist)
char *nick
char *serverlist
Irssi::Irc::Notifylist
notifylist_find(mask, ircnet)
char *mask
char *ircnet
#*******************************
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Server
#*******************************
int
notifylist_ison_server(server, nick)
Irssi::Irc::Server server
char *nick
#*******************************
MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Notifylist PREFIX = notifylist_
#*******************************
void
values(notify)
Irssi::Irc::Notifylist notify
PREINIT:
HV *hv;
AV *av;
char **tmp;
PPCODE:
hv = newHV();
hv_store(hv, "mask", 4, new_pv(notify->mask), 0);
hv_store(hv, "away_check", 10, newSViv(notify->away_check), 0);
hv_store(hv, "idle_check_time", 15, newSViv(notify->idle_check_time), 0);
av = newAV();
for (tmp = notify->ircnets; *tmp != NULL; tmp++) {
av_push(av, new_pv(*tmp));
}
hv_store(hv, "ircnets", 7, newRV_noinc((SV*)av), 0);
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
int
notifylist_ircnets_match(rec, ircnet)
Irssi::Irc::Notifylist rec
char *ircnet

28
src/perl/irc/module.h Normal file
View file

@ -0,0 +1,28 @@
#include "../core/module.h"
#include "irc-servers.h"
#include "irc-channels.h"
#include "irc-queries.h"
#include "bans.h"
#include "modes.h"
#include "mode-lists.h"
#include "netsplit.h"
#include "ignore.h"
#include "dcc/dcc.h"
#include "flood/autoignore.h"
#include "notifylist/notifylist.h"
typedef IRC_SERVER_REC *Irssi__Irc__Server;
typedef IRC_SERVER_CONNECT_REC *Irssi__Irc__Connect;
typedef IRC_CHANNEL_REC *Irssi__Irc__Channel;
typedef QUERY_REC *Irssi__Irc__Query;
typedef BAN_REC *Irssi__Irc__Ban;
typedef DCC_REC *Irssi__Irc__Dcc;
typedef NETSPLIT_REC *Irssi__Irc__Netsplit;
typedef NETSPLIT_SERVER_REC *Irssi__Irc__Netsplitserver;
typedef AUTOIGNORE_REC *Irssi__Irc__Autoignore;
typedef NOTIFYLIST_REC *Irssi__Irc__Notifylist;
typedef IGNORE_REC *Irssi__Irc__Ignore;

14
src/perl/irc/typemap Normal file
View file

@ -0,0 +1,14 @@
TYPEMAP
Irssi::Irc::Server T_PTROBJ
Irssi::Irc::Connect T_PTROBJ
Irssi::Irc::Channel T_PTROBJ
Irssi::Irc::Query T_PTROBJ
Irssi::Irc::Ban T_PTROBJ
Irssi::Irc::Dcc T_PTROBJ
Irssi::Irc::Netsplit T_PTROBJ
Irssi::Irc::Netsplitserver T_PTROBJ
Irssi::Irc::Autoignore T_PTROBJ
Irssi::Irc::Notifylist T_PTROBJ
Irssi::Irc::Ignore T_PTROBJ
Irssi::Nick T_PTROBJ