/* xchat-helloworld.vala * * Copyright (C) 2008 Andrea Del Signore * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Author: * Andrea Del Signore */ using GLib; using XChat; public HelloWorld hw = null; private const string name = "Vala Helloworld Plugin"; private const string desc = "Vala Helloworld Gnome XChat Plugin"; private const string ver = "0.1"; public static void xchat_plugin_get_info (string **plugin_name, string **plugin_desc, string **plugin_version, string **reserved) { *plugin_name = name; *plugin_desc = desc; *plugin_version = ver; if (reserved != null) *reserved = null; } public static bool xchat_plugin_init (Plugin plugin, string **plugin_name, string **plugin_desc, string **plugin_version, string arg) { xchat_plugin_get_info (plugin_name, plugin_desc, plugin_version, null); hw = new HelloWorld (plugin); return true; } public static bool xchat_plugin_deinit () { hw = null; return true; } public class HelloWorld : Object { private weak Plugin _plugin = null; public HelloWorld (construct Plugin plugin) { } public weak Plugin plugin { get { return _plugin; } construct { _plugin = value; } } construct { _plugin.hook_command ("HELLO_WORLD", XChat.Priorities.NORM, this.on_xchat_command, "Type /HELLO_WORLD for a response"); } public int on_xchat_command (string[] word, string[] word_eol) { _plugin.print ("Helloworld from Vala :)\n"); return EatTypes.ALL; } }