summaryrefslogtreecommitdiff
path: root/src/perl/xs
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-05-04 10:32:42 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-05-04 10:32:42 +0000
commitd3dc9a1307adc40425bf162f1f867a39e535f501 (patch)
treed3c92a8e431391d679ae5341cb4e865f00449761 /src/perl/xs
parentbacfcb060c1b687f70db4d59797e1cbc8bfe0f62 (diff)
downloadirssi-d3dc9a1307adc40425bf162f1f867a39e535f501.zip
.. lots of changes ..
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@197 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/perl/xs')
-rw-r--r--src/perl/xs/Irssi-core.xs13
-rw-r--r--src/perl/xs/Irssi-netsplit.xs23
-rw-r--r--src/perl/xs/Irssi-server.xs2
-rw-r--r--src/perl/xs/module.h1
-rw-r--r--src/perl/xs/typemap1
5 files changed, 34 insertions, 6 deletions
diff --git a/src/perl/xs/Irssi-core.xs b/src/perl/xs/Irssi-core.xs
index b7cdcb6d..324637ae 100644
--- a/src/perl/xs/Irssi-core.xs
+++ b/src/perl/xs/Irssi-core.xs
@@ -88,8 +88,18 @@ command_bind(cmd, category, func)
char *func
CODE:
char *signal;
+ GSList *tmp;
- command_bind(cmd, *category ? category : "Perl scripts' commands", NULL);
+ /* Don't add the command twice */
+ if (*category == '\0') category = "Perl scripts' commands";
+ for (tmp = commands; tmp != NULL; tmp = tmp->next) {
+ COMMAND_REC *rec = tmp->data;
+
+ if (g_strcasecmp(rec->cmd, cmd) == 0 &&
+ g_strcasecmp(rec->category, category) == 0)
+ break;
+ }
+ if (tmp == NULL) command_bind(cmd, category, NULL);
signal = g_strconcat("command ", cmd, NULL);
perl_signal_add(signal, func);
g_free(signal);
@@ -101,7 +111,6 @@ command_unbind(cmd, func)
CODE:
char *signal;
- command_unbind(cmd, NULL);
signal = g_strconcat("command ", cmd, NULL);
perl_signal_remove(signal, func);
g_free(signal);
diff --git a/src/perl/xs/Irssi-netsplit.xs b/src/perl/xs/Irssi-netsplit.xs
index 0c1e998f..428cb61a 100644
--- a/src/perl/xs/Irssi-netsplit.xs
+++ b/src/perl/xs/Irssi-netsplit.xs
@@ -22,13 +22,30 @@ void
values(netsplit)
Irssi::Netsplit netsplit
PREINIT:
- HV *hv;
+ 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, "server", 6, new_pv(netsplit->server), 0);
- hv_store(hv, "destserver", 10, new_pv(netsplit->destserver), 0);
hv_store(hv, "destroy", 7, newSViv(netsplit->destroy), 0);
+
+ stash = gv_stashpv("Irssi::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 PACKAGE = Irssi::Netsplitserver
+#*******************************
+
+void
+values(rec)
+ Irssi::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/xs/Irssi-server.xs b/src/perl/xs/Irssi-server.xs
index 326b8d99..f53527ec 100644
--- a/src/perl/xs/Irssi-server.xs
+++ b/src/perl/xs/Irssi-server.xs
@@ -53,7 +53,7 @@ void
values(server)
Irssi::Server server
PREINIT:
- HV *hv, *stash;
+ HV *hv;
char *type;
PPCODE:
type = "IRC";
diff --git a/src/perl/xs/module.h b/src/perl/xs/module.h
index 350f3de0..3a55f787 100644
--- a/src/perl/xs/module.h
+++ b/src/perl/xs/module.h
@@ -44,6 +44,7 @@ typedef RECONNECT_REC *Irssi__Reconnect;
typedef NICK_REC *Irssi__Nick;
typedef BAN_REC *Irssi__Ban;
typedef NETSPLIT_REC *Irssi__Netsplit;
+typedef NETSPLIT_SERVER_REC *Irssi__Netsplitserver;
typedef IGNORE_REC *Irssi__Ignore;
typedef DCC_REC *Irssi__Dcc;
diff --git a/src/perl/xs/typemap b/src/perl/xs/typemap
index 0e61ce06..5173ebe4 100644
--- a/src/perl/xs/typemap
+++ b/src/perl/xs/typemap
@@ -9,6 +9,7 @@ Irssi::Nick T_PTROBJ
Irssi::Ban T_PTROBJ
Irssi::Dcc T_PTROBJ
Irssi::Netsplit T_PTROBJ
+Irssi::Netsplitserver T_PTROBJ
Irssi::Autoignore T_PTROBJ
Irssi::Log T_PTROBJ
Irssi::Rawlog T_PTROBJ