This page contains some vala code that I wrote as a test bed for other programs or just because I want to better understand some vala functionality.
Snul is a simple network utility library I wrote to replace gnet library dependency from Tuntun the successor of ovpnClient. It implements just a simple and minimalistic tcp socket client and I estimate to replace it with Gio library whenever it will do tcp streams.
For this reason I consider snul a quick, simple and provisory hack and I advise everyone to stay away from it and use only if necessary 🙂
Be aware, Snul actually requires vala compiler version 0.1.7 to compile.
This is my “successful” attempt to write an XChat plugin in vala. Even if it’s not optimal from the vala style point of view, it works pretty well, so I think that could be useful to someone else too.
How to compile and use:
- download the tarball
- extract it to some folder
- compile using make
- the only dependency is glib 2.0, so be sure that the corresponding dev package is installed
- copy the resulting xchat-helloworld.so in ~/.xchat2/plugins/
- run xchat or xchat-gnome (I tested it only with xchat-gnome, but it should works with normal xchat too)
- enable the plugin from xchat preferences dialog
- now if you type /help in your chat window, you should have a new command: HELLO_WORLD
- so type it and enjoy the result!
The vapi file could be greatly improved, especially the init and get_info functions are great candidate to become virtual methods, but first I need to investigate on how vala supports virtual methods on classes that aren’t gobjects.
After some time I wrote a useful plugin (at least for me) with my xchat vapi files. It’s a pastebin extension for xchat-gnome, that simply post your clipboard (or primary selection) to pastebin.com and write the resulting link in the current chat window.
To compile and use, dowload it and follow the instructions written in the README file.