diff options
author | Timo Sirainen <cras@irssi.org> | 2000-12-09 20:54:47 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-12-09 20:54:47 +0000 |
commit | 5dcd6833242a88cbf0fdbcfa6a25fbe3bad77426 (patch) | |
tree | 2f9431cda59df10bcb6f80e2e5e662beead43e73 /src/perl/irc | |
parent | 8d98e80a6b914c6e1708b2ccc5cfd49e0ed43584 (diff) | |
download | irssi-5dcd6833242a88cbf0fdbcfa6a25fbe3bad77426.zip |
fixes, perl should work correctly now :)
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@982 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/perl/irc')
-rw-r--r-- | src/perl/irc/Bans.xs | 16 | ||||
-rw-r--r-- | src/perl/irc/Dcc.xs | 32 | ||||
-rw-r--r-- | src/perl/irc/Flood.xs | 16 | ||||
-rw-r--r-- | src/perl/irc/Irc.pm | 2 | ||||
-rw-r--r-- | src/perl/irc/Irc.xs | 123 | ||||
-rw-r--r-- | src/perl/irc/IrcServer.xs | 27 | ||||
-rw-r--r-- | src/perl/irc/Netsplit.xs | 37 | ||||
-rw-r--r-- | src/perl/irc/Notifylist.xs | 20 | ||||
-rw-r--r-- | src/perl/irc/typemap | 18 |
9 files changed, 137 insertions, 154 deletions
diff --git a/src/perl/irc/Bans.xs b/src/perl/irc/Bans.xs index c89ff4c5..5412018d 100644 --- a/src/perl/irc/Bans.xs +++ b/src/perl/irc/Bans.xs @@ -22,19 +22,3 @@ void ban_remove(channel, ban) Irssi::Irc::Channel channel char *ban - -#******************************* -MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Ban -#******************************* - -void -init(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))); diff --git a/src/perl/irc/Dcc.xs b/src/perl/irc/Dcc.xs index 0bbd1166..4a68f4e1 100644 --- a/src/perl/irc/Dcc.xs +++ b/src/perl/irc/Dcc.xs @@ -46,35 +46,3 @@ void dcc_chat_send(dcc, data) Irssi::Irc::Dcc dcc char *data - -void -init(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, irssi_bless(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, new_bless(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))); - diff --git a/src/perl/irc/Flood.xs b/src/perl/irc/Flood.xs index d6b70672..5a92e442 100644 --- a/src/perl/irc/Flood.xs +++ b/src/perl/irc/Flood.xs @@ -11,19 +11,3 @@ autoignore_remove(server, mask, level) Irssi::Irc::Server server char *mask int level - -#******************************* -MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Autoignore -#******************************* - -void -init(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))); diff --git a/src/perl/irc/Irc.pm b/src/perl/irc/Irc.pm index a7c77742..ee2d034a 100644 --- a/src/perl/irc/Irc.pm +++ b/src/perl/irc/Irc.pm @@ -18,5 +18,7 @@ require DynaLoader; bootstrap Irssi::Irc $VERSION; +Irssi::Irc::init(); + 1; diff --git a/src/perl/irc/Irc.xs b/src/perl/irc/Irc.xs index f70e9a22..58c417aa 100644 --- a/src/perl/irc/Irc.xs +++ b/src/perl/irc/Irc.xs @@ -1,9 +1,132 @@ #include "module.h" +static void perl_irc_connect_fill_hash(HV *hv, IRC_SERVER_CONNECT_REC *conn) +{ + perl_connect_fill_hash(hv, (SERVER_CONNECT_REC *) conn); + hv_store(hv, "alternate_nick", 14, new_pv(conn->alternate_nick), 0); +} + +static void perl_irc_server_fill_hash(HV *hv, IRC_SERVER_REC *server) +{ + perl_server_fill_hash(hv, 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); +} + +static void perl_ban_fill_hash(HV *hv, BAN_REC *ban) +{ + 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); +} + +static void perl_dcc_fill_hash(HV *hv, DCC_REC *dcc) +{ + HV *stash; + + 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, irssi_bless(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, new_bless(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); +} + +static void perl_netsplit_fill_hash(HV *hv, NETSPLIT_REC *netsplit) +{ + HV *stash; + + 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, new_bless(netsplit->server, stash), 0); + /*FIXME: add GSList *channels;*/ +} + +static void perl_netsplit_server_fill_hash(HV *hv, NETSPLIT_SERVER_REC *rec) +{ + 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); +} + +static void perl_autoignore_fill_hash(HV *hv, AUTOIGNORE_REC *ai) +{ + 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); +} + +static void perl_notifylist_fill_hash(HV *hv, NOTIFYLIST_REC *notify) +{ + AV *av; + char **tmp; + + 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); +} + +static PLAIN_OBJECT_INIT_REC irc_plains[] = { + { "Irssi::Irc::Ban", (PERL_OBJECT_FUNC) perl_ban_fill_hash }, + { "Irssi::Irc::Dcc", (PERL_OBJECT_FUNC) perl_dcc_fill_hash }, + { "Irssi::Irc::Netsplit", (PERL_OBJECT_FUNC) perl_netsplit_fill_hash }, + { "Irssi::Irc::Netsplitserver", (PERL_OBJECT_FUNC) perl_netsplit_server_fill_hash }, + { "Irssi::Irc::Autoignore", (PERL_OBJECT_FUNC) perl_autoignore_fill_hash }, + { "Irssi::Irc::Notifylist", (PERL_OBJECT_FUNC) perl_notifylist_fill_hash }, + + { NULL, NULL } +}; + MODULE = Irssi::Irc PACKAGE = Irssi::Irc PROTOTYPES: ENABLE +void +init() +PREINIT: + static int initialized = FALSE; + int chat_type; +CODE: + if (initialized) return; + initialized = TRUE; + + chat_type = chat_protocol_lookup("IRC"); + + irssi_add_object(module_get_uniq_id("SERVER CONNECT", 0), + chat_type, "Irssi::Irc::Connect", + (PERL_OBJECT_FUNC) perl_irc_connect_fill_hash); + irssi_add_object(module_get_uniq_id("SERVER", 0), + chat_type, "Irssi::Irc::Server", + (PERL_OBJECT_FUNC) perl_irc_server_fill_hash); + irssi_add_plains(irc_plains); + INCLUDE: Bans.xs INCLUDE: IrcServer.xs INCLUDE: IrcChannel.xs diff --git a/src/perl/irc/IrcServer.xs b/src/perl/irc/IrcServer.xs index c39abaa4..9ee76c2f 100644 --- a/src/perl/irc/IrcServer.xs +++ b/src/perl/irc/IrcServer.xs @@ -27,36 +27,9 @@ send_raw_split(server, cmd, nickarg, max_nicks) CODE: irc_send_cmd_split(server, cmd, nickarg, max_nicks); -void -init(server) - Irssi::Irc::Server server -PREINIT: - HV *hv; -CODE: - hv = hvref(ST(0)); - if (hv != NULL) { - perl_server_fill_hash(hv, 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); - } - MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Connect PREFIX = irc_server_ Irssi::Irc::Server irc_server_connect(conn) Irssi::Irc::Connect conn - -void -init(conn) - Irssi::Irc::Connect conn -PREINIT: - HV *hv; -CODE: - hv = hvref(ST(0)); - if (hv != NULL) { - perl_connect_fill_hash(hv, conn); - hv_store(hv, "alternate_nick", 14, new_pv(conn->alternate_nick), 0); - } diff --git a/src/perl/irc/Netsplit.xs b/src/perl/irc/Netsplit.xs index a7669b43..c6d7c6e8 100644 --- a/src/perl/irc/Netsplit.xs +++ b/src/perl/irc/Netsplit.xs @@ -12,40 +12,3 @@ netsplit_find_channel(server, nick, address, channel) char *nick char *address char *channel - - -#******************************* -MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Netsplit -#******************************* - -void -init(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, new_bless(netsplit->server, stash), 0); - /*FIXME: add GSList *channels;*/ - XPUSHs(sv_2mortal(newRV_noinc((SV*)hv))); - -#******************************* -MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Netsplitserver -#******************************* - -void -init(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))); diff --git a/src/perl/irc/Notifylist.xs b/src/perl/irc/Notifylist.xs index 3ef75c04..2f830639 100644 --- a/src/perl/irc/Notifylist.xs +++ b/src/perl/irc/Notifylist.xs @@ -45,26 +45,6 @@ notifylist_ison_server(server, nick) MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Notifylist PREFIX = notifylist_ #******************************* -void -init(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 diff --git a/src/perl/irc/typemap b/src/perl/irc/typemap index 8bec8f9f..928eceb6 100644 --- a/src/perl/irc/typemap +++ b/src/perl/irc/typemap @@ -5,20 +5,26 @@ Irssi::Irc::Channel T_IrssiObj Irssi::Irc::Query T_IrssiObj Irssi::Irc::Nick T_IrssiObj -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::Ban T_PlainObj +Irssi::Irc::Dcc T_PlainObj +Irssi::Irc::Netsplit T_PlainObj +Irssi::Irc::Netsplitserver T_PlainObj +Irssi::Irc::Autoignore T_PlainObj +Irssi::Irc::Notifylist T_PlainObj INPUT T_IrssiObj $var = irssi_ref_object($arg) +T_PlainObj + $var = irssi_ref_object($arg) + OUTPUT T_IrssiObj $arg = irssi_bless((SERVER_REC *)$var); +T_PlainObj + $arg = irssi_bless_plain(\"$type\", $var); + |