Commit Graph

11 Commits

Author SHA1 Message Date
Tilka c5036a3ff8 fix random crashes upon !reload
A struct plugin_hub_internals was falsely casted to struct
plugin_callback_data. This caused the contained commands list pointer to point to
a struct hub_info and commands->size took the value of a pointer to a struct
net_connection. Since size is increased/decreased every time an item is
added to/removed from the list, this resulted in some funny crashes.

This fix is a little dirty as it exports some internals.
2012-04-21 09:22:06 +02:00
Jan Vidar Krey 55030935a7 Merge https://github.com/Tilka/uhub 2012-04-19 23:17:39 +02:00
Tilka e408ae3eba automatically clean up plugin commands 2012-04-19 02:53:43 +02:00
Jan Vidar Krey 1dba731cc3 Fix bug #158 - Added plugin for setting topic (hub description).
Load plugin mod_topic, and it will provide 3 new user commands:

!topic - set new topic
!cleartopic - reset the topic (use default hub description)
!showtopic - show the current topic
2012-04-19 00:33:38 +02:00
Jan Vidar Krey df7bbc094f Command arguments handling + cleanups
Fix bug #185 - Args of !commands lost/damaged.
All string arguments were incorrectly freed after being added to the argument list for a command.
Instead this fix makes sure it is properly copied into a new string, and by doing so this requires
a new API for dealing with hub command arguments in a type safe manner, and also allows for each
argument to be cleaned up properly when the command is no longer needed.

This also fixes issues with parse errors for certain types, and optional arguments (previously it was impossible
to tell the difference for an integer with value 0 or if no integer was given).

All arguments can now be accessed through the new functions
hub_command_arg_reset() and hub_command_arg_next().

These functions are also exposed to plug-ins.

The argument type notations for 'n' has changed to mean nick (string),
and 'u' is used for a user (struct hub_user - must be online).
2012-04-18 23:03:05 +02:00
Jan Vidar Krey 8607b40278 Fix bug #180 - Crash after signal SIGHUP. 2012-01-19 02:58:20 +01:00
Jan Vidar Krey eee2636582 Added a chat only hub plugin that disables searching and connection setup.
This also deprecates the built-in chat_only configuration option.
If you need this functionality, then load the mod_chat_only plugin (if it is loaded then only operators
are able to search, connect, etc).
2012-01-09 20:58:19 +01:00
Jan Vidar Krey f2cb84180a Refactored command parsing.
Allows for automatically tested command parsing by splitting parsing
and invokation of the commands.
2011-12-19 00:34:45 +01:00
Jan Vidar Krey 6d609e18a2 Windows/VS2010 fixes. 2011-12-11 12:53:09 +01:00
Jan Vidar Krey afda1d7b9d Added a LOG_PLUGIN macro for plugin output debug messages.
Converted all TRACE messages related to plugins to LOG_PLUGIN.
2011-12-09 16:38:11 +01:00
Jan Vidar Krey 318163c066 Added support for dynamic commands.
Dynamic commands are user commands that can be added dynamically to
the hub by a plugin.

The example plugin (mod_example.c) adds a !example command that when
invoked send a message to the user who invoked it.
2011-12-09 10:29:50 +01:00