summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-11-18 16:36:31 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-11-18 16:36:31 +0000
commit73a3b8d908f8f8bf9c819c5b97d529dc8f36375c (patch)
tree5cedbc4da02d25232c827261fec7a7dbf2f9f3e5 /src
parentc374e628dcb87fad99a9cfc147884fd8ef7d4632 (diff)
downloadirssi-73a3b8d908f8f8bf9c819c5b97d529dc8f36375c.zip
Irssi::Chatnet can now be accessed from perl.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2055 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/perl/perl-common.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/perl/perl-common.c b/src/perl/perl-common.c
index b382e4c4..946eb993 100644
--- a/src/perl/perl-common.c
+++ b/src/perl/perl-common.c
@@ -34,6 +34,7 @@
#include "window-item-def.h"
#include "chat-protocols.h"
+#include "chatnets.h"
#include "servers.h"
#include "channels.h"
#include "queries.h"
@@ -202,6 +203,29 @@ void irssi_callXS(void (*subaddr)(CV* cv), CV *cv, SV **mark)
PUTBACK;
}
+void perl_chatnet_fill_hash(HV *hv, CHATNET_REC *chatnet)
+{
+ char *type, *chat_type;
+
+ g_return_if_fail(hv != NULL);
+ g_return_if_fail(chatnet != NULL);
+
+ type = "CHATNET";
+ chat_type = (char *) chat_protocol_find_id(chatnet->chat_type)->name;
+
+ hv_store(hv, "type", 4, new_pv(type), 0);
+ hv_store(hv, "chat_type", 9, new_pv(chat_type), 0);
+
+ hv_store(hv, "name", 4, new_pv(chatnet->name), 0);
+
+ hv_store(hv, "nick", 4, new_pv(chatnet->nick), 0);
+ hv_store(hv, "username", 8, new_pv(chatnet->username), 0);
+ hv_store(hv, "realname", 8, new_pv(chatnet->realname), 0);
+
+ hv_store(hv, "own_host", 8, new_pv(chatnet->own_host), 0);
+ hv_store(hv, "autosendcmd", 11, new_pv(chatnet->autosendcmd), 0);
+}
+
void perl_connect_fill_hash(HV *hv, SERVER_CONNECT_REC *conn)
{
char *type, *chat_type;
@@ -481,6 +505,12 @@ static void perl_register_protocol(CHAT_PROTOCOL_REC *rec)
irssi_add_object(type, chat_type, stash,
(PERL_OBJECT_FUNC) perl_nick_fill_hash);
+ /* chatnets */
+ type = module_get_uniq_id("CHATNET", 0);
+ g_snprintf(stash, sizeof(stash), "Irssi::%s::Chatnet", name);
+ irssi_add_object(type, chat_type, stash,
+ (PERL_OBJECT_FUNC) perl_chatnet_fill_hash);
+
/* server specific */
type = module_get_uniq_id("SERVER", 0);
g_snprintf(stash, sizeof(stash), "Irssi::%s::Server", name);