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 _PurpleCmdPriority PurpleCmdPriority;
00034 typedef enum _PurpleCmdFlag     PurpleCmdFlag;
00035 typedef enum _PurpleCmdStatus   PurpleCmdStatus;
00036 typedef enum _PurpleCmdRet      PurpleCmdRet;
00037 
00038 enum _PurpleCmdStatus {
00039     PURPLE_CMD_STATUS_OK,
00040     PURPLE_CMD_STATUS_FAILED,
00041     PURPLE_CMD_STATUS_NOT_FOUND,
00042     PURPLE_CMD_STATUS_WRONG_ARGS,
00043     PURPLE_CMD_STATUS_WRONG_PRPL,
00044     PURPLE_CMD_STATUS_WRONG_TYPE,
00045 };
00046 
00047 enum _PurpleCmdRet {
00048     PURPLE_CMD_RET_OK,       
00049     PURPLE_CMD_RET_FAILED,   
00050     PURPLE_CMD_RET_CONTINUE, 
00051 };
00052 
00053 #define PURPLE_CMD_FUNC(func) ((PurpleCmdFunc)func)
00054 
00055 typedef PurpleCmdRet (*PurpleCmdFunc)(PurpleConversation *, const gchar *cmd,
00056                                   gchar **args, gchar **error, void *data);
00057 typedef guint PurpleCmdId;
00058 
00059 enum _PurpleCmdPriority {
00060     PURPLE_CMD_P_VERY_LOW  = -1000,
00061     PURPLE_CMD_P_LOW       =     0,
00062     PURPLE_CMD_P_DEFAULT   =  1000,
00063     PURPLE_CMD_P_PRPL      =  2000,
00064     PURPLE_CMD_P_PLUGIN    =  3000,
00065     PURPLE_CMD_P_ALIAS     =  4000,
00066     PURPLE_CMD_P_HIGH      =  5000,
00067     PURPLE_CMD_P_VERY_HIGH =  6000,
00068 };
00069 
00070 enum _PurpleCmdFlag {
00071     PURPLE_CMD_FLAG_IM               = 0x01,
00072     PURPLE_CMD_FLAG_CHAT             = 0x02,
00073     PURPLE_CMD_FLAG_PRPL_ONLY        = 0x04,
00074     PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS = 0x08,
00075 };
00076 
00077 
00080 #ifdef __cplusplus
00081 extern "C" {
00082 #endif
00083 
00084 /**************************************************************************/
00086 /**************************************************************************/
00126 PurpleCmdId purple_cmd_register(const gchar *cmd, const gchar *args, PurpleCmdPriority p, PurpleCmdFlag f,
00127                              const gchar *prpl_id, PurpleCmdFunc func, const gchar *helpstr, void *data);
00128 
00138 void purple_cmd_unregister(PurpleCmdId id);
00139 
00158 PurpleCmdStatus purple_cmd_do_command(PurpleConversation *conv, const gchar *cmdline,
00159                                   const gchar *markup, gchar **errormsg);
00160 
00172 GList *purple_cmd_list(PurpleConversation *conv);
00173 
00186 GList *purple_cmd_help(PurpleConversation *conv, const gchar *cmd);
00187 
00190 #ifdef __cplusplus
00191 }
00192 #endif
00193 
00194 #endif /* _PURPLE_CMDS_H_ */