cmds.h

Go to the documentation of this file.
00001 
00006 /* Copyright (C) 2003 Timothy Ringenbach <omarvo@hotmail.com>
00007  *
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
00021  *
00022  */
00023 #ifndef _PURPLE_CMDS_H_
00024 #define _PURPLE_CMDS_H_
00025 
00026 #include "conversation.h"
00027 
00028 /**************************************************************************/
00030 /**************************************************************************/
00033 typedef enum _PurpleCmdStatus {
00034     PURPLE_CMD_STATUS_OK,
00035     PURPLE_CMD_STATUS_FAILED,
00036     PURPLE_CMD_STATUS_NOT_FOUND,
00037     PURPLE_CMD_STATUS_WRONG_ARGS,
00038     PURPLE_CMD_STATUS_WRONG_PRPL,
00039     PURPLE_CMD_STATUS_WRONG_TYPE,
00040 } PurpleCmdStatus;
00041 
00042 typedef enum _PurpleCmdRet {
00043     PURPLE_CMD_RET_OK,       
00044     PURPLE_CMD_RET_FAILED,   
00045     PURPLE_CMD_RET_CONTINUE, 
00046 } PurpleCmdRet;
00047 
00048 #define PURPLE_CMD_FUNC(func) ((PurpleCmdFunc)func)
00049 
00050 typedef PurpleCmdRet (*PurpleCmdFunc)(PurpleConversation *, const gchar *cmd,
00051                                   gchar **args, gchar **error, void *data);
00052 typedef guint PurpleCmdId;
00053 
00054 typedef enum _PurpleCmdPriority {
00055     PURPLE_CMD_P_VERY_LOW  = -1000,
00056     PURPLE_CMD_P_LOW       =     0,
00057     PURPLE_CMD_P_DEFAULT   =  1000,
00058     PURPLE_CMD_P_PRPL      =  2000,
00059     PURPLE_CMD_P_PLUGIN    =  3000,
00060     PURPLE_CMD_P_ALIAS     =  4000,
00061     PURPLE_CMD_P_HIGH      =  5000,
00062     PURPLE_CMD_P_VERY_HIGH =  6000,
00063 } PurpleCmdPriority;
00064 
00071 typedef enum _PurpleCmdFlag {
00073     PURPLE_CMD_FLAG_IM               = 0x01,
00075     PURPLE_CMD_FLAG_CHAT             = 0x02,
00077     PURPLE_CMD_FLAG_PRPL_ONLY        = 0x04,
00079     PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS = 0x08,
00080 } PurpleCmdFlag;
00081 
00082 
00085 #ifdef __cplusplus
00086 extern "C" {
00087 #endif
00088 
00089 /**************************************************************************/
00091 /**************************************************************************/
00144 PurpleCmdId purple_cmd_register(const gchar *cmd, const gchar *args, PurpleCmdPriority p, PurpleCmdFlag f,
00145                              const gchar *prpl_id, PurpleCmdFunc func, const gchar *helpstr, void *data);
00146 
00156 void purple_cmd_unregister(PurpleCmdId id);
00157 
00176 PurpleCmdStatus purple_cmd_do_command(PurpleConversation *conv, const gchar *cmdline,
00177                                   const gchar *markup, gchar **errormsg);
00178 
00192 GList *purple_cmd_list(PurpleConversation *conv);
00193 
00206 GList *purple_cmd_help(PurpleConversation *conv, const gchar *cmd);
00207 
00210 #ifdef __cplusplus
00211 }
00212 #endif
00213 
00214 #endif /* _PURPLE_CMDS_H_ */