cmds.h

Go to the documentation of this file.
00001 
00007 /* Copyright (C) 2003 Timothy Ringenbach <omarvo@hotmail.com>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
00022  *
00023  */
00024 #ifndef _PURPLE_CMDS_H_
00025 #define _PURPLE_CMDS_H_
00026 
00027 #include "conversation.h"
00028 
00029 /**************************************************************************/
00031 /**************************************************************************/
00035 typedef enum _PurpleCmdStatus {
00036     PURPLE_CMD_STATUS_OK,
00037     PURPLE_CMD_STATUS_FAILED,
00038     PURPLE_CMD_STATUS_NOT_FOUND,
00039     PURPLE_CMD_STATUS_WRONG_ARGS,
00040     PURPLE_CMD_STATUS_WRONG_PRPL,
00041     PURPLE_CMD_STATUS_WRONG_TYPE
00042 } PurpleCmdStatus;
00043 
00051 typedef enum _PurpleCmdRet {
00052     PURPLE_CMD_RET_OK,       
00053     PURPLE_CMD_RET_FAILED,   
00054     PURPLE_CMD_RET_CONTINUE 
00055 } PurpleCmdRet;
00056 
00057 #define PURPLE_CMD_FUNC(func) ((PurpleCmdFunc)func)
00058 
00063 typedef PurpleCmdRet (*PurpleCmdFunc)(PurpleConversation *, const gchar *cmd,
00064                                   gchar **args, gchar **error, void *data);
00069 typedef guint PurpleCmdId;
00070 
00071 typedef enum _PurpleCmdPriority {
00072     PURPLE_CMD_P_VERY_LOW  = -1000,
00073     PURPLE_CMD_P_LOW       =     0,
00074     PURPLE_CMD_P_DEFAULT   =  1000,
00075     PURPLE_CMD_P_PRPL      =  2000,
00076     PURPLE_CMD_P_PLUGIN    =  3000,
00077     PURPLE_CMD_P_ALIAS     =  4000,
00078     PURPLE_CMD_P_HIGH      =  5000,
00079     PURPLE_CMD_P_VERY_HIGH =  6000
00080 } PurpleCmdPriority;
00081 
00088 typedef enum _PurpleCmdFlag {
00090     PURPLE_CMD_FLAG_IM               = 0x01,
00092     PURPLE_CMD_FLAG_CHAT             = 0x02,
00094     PURPLE_CMD_FLAG_PRPL_ONLY        = 0x04,
00096     PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS = 0x08
00097 } PurpleCmdFlag;
00098 
00099 
00102 #ifdef __cplusplus
00103 extern "C" {
00104 #endif
00105 
00106 /**************************************************************************/
00108 /**************************************************************************/
00161 PurpleCmdId purple_cmd_register(const gchar *cmd, const gchar *args, PurpleCmdPriority p, PurpleCmdFlag f,
00162                              const gchar *prpl_id, PurpleCmdFunc func, const gchar *helpstr, void *data);
00163 
00173 void purple_cmd_unregister(PurpleCmdId id);
00174 
00193 PurpleCmdStatus purple_cmd_do_command(PurpleConversation *conv, const gchar *cmdline,
00194                                   const gchar *markup, gchar **errormsg);
00195 
00209 GList *purple_cmd_list(PurpleConversation *conv);
00210 
00223 GList *purple_cmd_help(PurpleConversation *conv, const gchar *cmd);
00224 
00230 gpointer purple_cmds_get_handle(void);
00231 
00236 void purple_cmds_init(void);
00237 
00242 void purple_cmds_uninit(void);
00243 
00246 #ifdef __cplusplus
00247 }
00248 #endif
00249 
00250 #endif /* _PURPLE_CMDS_H_ */