19 April,2012
My own dream JabberB0t
So I finish my research. My jabberb0t (https://github.com/unStatiK/Nostromo) 'Nostromo' really fast…and easy for build plugin. Why? It is simple: So writed our “HelloWorld” plugin… For this need do 2 steps
Step 1.
add your plugin handler to plugin table
# plugins / plugins.c
#include “hello_plugin.c”
…
add_plugin(“join”,0,&hello_handler); .
…
Step 2.
write plugin handler
# plugins / hello_plugin.c
void hello_handler( xmpp_conn_t * const conn,xmpp_ctx_t *ctx){
if(!strcmp(data,”hello”)){
xmpp_stanza_t *reply, *body, *text;
char *replytext;
reply = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(reply, “message”);
xmpp_stanza_set_type(reply, “chat”);
xmpp_stanza_set_attribute(reply, “to”, xmpp_stanza_get_attribute(stanza, “from”));
body = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(body, “body”);
replytext = malloc(strlen(“Hello World!”) + 1);
strcpy(replytext, data);
strcat(replytext, “Hello World!”);
text = xmpp_stanza_new(ctx);
xmpp_stanza_set_text(text, replytext);
xmpp_stanza_add_child(body, text);
xmpp_stanza_add_child(reply, body);
xmpp_send(conn, reply);
xmpp_stanza_release(reply);
xmpp_stanza_release(body);
xmpp_stanza_release(text);
}
}
Rebuild bot :).
My bot’s main feature is dynamic load & unload plugin. For implement it I use idea hash-table with address to plugin handler:
"name(a.k.a parametr)" => address
For unload plugin sufficient do:
”name” => null
For load plugin sufficient do:
“name” => &plugin_handler
I think it easy way…
So at finish a want say I DON’T COMPLETE WORK under Nostromo, because I see it his possibilities, but I think not necessary to spend time on the useless work, if by whom that will be necessary this bot I will make his completely worker.
Thx:)
14 July,2013
Roadmap content
roadmap open source project:• Script static build Love2d and example simple game(snake mmm???)
• Nostrome ultimate jabber b0t fast and security
• Calculator of Matrix competency
• Web torrent archive
• Caravan Perl forum engine
• Patch for OBS for support Slackware
• Implementation GameSpy server for Cossacs
• Slackbuilds for patching kernel with grsecurity and build
roadmap article:
• GDI + WPF with fix bug
• Create Dancer application with PostgreSQL on OpenShift
• OpenShift cartridge `PyPy`
• OpenShift cartridge `JRuby + Jetty`
• OpenShift cartridge `Mono`
roadmap for coursera:
• crypto I
• crypto II
• introduce astronomy
• game theory
roadmap for staremax project:
• open hardware hub(repositories)
• `StackOverflow` for electrical engineerings (only RU lang)
Article Stack ↓