mirror of
https://github.com/weechat/weechat.git
synced 2026-07-05 01:03:14 +02:00
add constants for python return codes
This commit is contained in:
@@ -780,7 +780,7 @@ weechat_python_load (t_weechat_plugin *plugin, char *filename)
|
||||
{
|
||||
FILE *fp;
|
||||
PyThreadState *python_current_interpreter;
|
||||
PyObject *weechat_module, *weechat_outputs;
|
||||
PyObject *weechat_module, *weechat_outputs, *weechat_dict;
|
||||
|
||||
plugin->printf_server (plugin, "Loading Python script \"%s\"", filename);
|
||||
|
||||
@@ -825,6 +825,14 @@ weechat_python_load (t_weechat_plugin *plugin, char *filename)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* define some constants */
|
||||
weechat_dict = PyModule_GetDict(weechat_module);
|
||||
PyDict_SetItemString(weechat_dict, "PLUGIN_RC_OK", PyInt_FromLong((long) PLUGIN_RC_OK));
|
||||
PyDict_SetItemString(weechat_dict, "PLUGIN_RC_KO", PyInt_FromLong((long) PLUGIN_RC_KO));
|
||||
PyDict_SetItemString(weechat_dict, "PLUGIN_RC_OK_IGNORE_WEECHAT", PyInt_FromLong((long) PLUGIN_RC_OK_IGNORE_WEECHAT));
|
||||
PyDict_SetItemString(weechat_dict, "PLUGIN_RC_OK_IGNORE_PLUGINS", PyInt_FromLong((long) PLUGIN_RC_OK_IGNORE_PLUGINS));
|
||||
PyDict_SetItemString(weechat_dict, "PLUGIN_RC_OK_IGNORE_ALL", PyInt_FromLong((long) PLUGIN_RC_OK_IGNORE_ALL));
|
||||
|
||||
weechat_outputs = Py_InitModule("weechatOutputs", weechat_python_output_funcs);
|
||||
if (weechat_outputs == NULL)
|
||||
{
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
WeeChat, for plugins, or both */
|
||||
#define PLUGIN_RC_OK_IGNORE_WEECHAT 1 /* ignore WeeChat for this message */
|
||||
#define PLUGIN_RC_OK_IGNORE_PLUGINS 2 /* ignore other plugins for this msg */
|
||||
#define PLUGIN_RC_OK_IGNORE_ALL (PLUGIN_RC_DISCARD_WEECHAT \
|
||||
| PLUGIN_RC_DISCARD_PLUGINS)
|
||||
#define PLUGIN_RC_OK_IGNORE_ALL (PLUGIN_RC_OK_IGNORE_WEECHAT \
|
||||
| PLUGIN_RC_OK_IGNORE_PLUGINS)
|
||||
/* ignore WeeChat and other plugins */
|
||||
|
||||
typedef struct t_plugin_dcc_info t_plugin_dcc_info;
|
||||
|
||||
@@ -780,7 +780,7 @@ weechat_python_load (t_weechat_plugin *plugin, char *filename)
|
||||
{
|
||||
FILE *fp;
|
||||
PyThreadState *python_current_interpreter;
|
||||
PyObject *weechat_module, *weechat_outputs;
|
||||
PyObject *weechat_module, *weechat_outputs, *weechat_dict;
|
||||
|
||||
plugin->printf_server (plugin, "Loading Python script \"%s\"", filename);
|
||||
|
||||
@@ -825,6 +825,14 @@ weechat_python_load (t_weechat_plugin *plugin, char *filename)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* define some constants */
|
||||
weechat_dict = PyModule_GetDict(weechat_module);
|
||||
PyDict_SetItemString(weechat_dict, "PLUGIN_RC_OK", PyInt_FromLong((long) PLUGIN_RC_OK));
|
||||
PyDict_SetItemString(weechat_dict, "PLUGIN_RC_KO", PyInt_FromLong((long) PLUGIN_RC_KO));
|
||||
PyDict_SetItemString(weechat_dict, "PLUGIN_RC_OK_IGNORE_WEECHAT", PyInt_FromLong((long) PLUGIN_RC_OK_IGNORE_WEECHAT));
|
||||
PyDict_SetItemString(weechat_dict, "PLUGIN_RC_OK_IGNORE_PLUGINS", PyInt_FromLong((long) PLUGIN_RC_OK_IGNORE_PLUGINS));
|
||||
PyDict_SetItemString(weechat_dict, "PLUGIN_RC_OK_IGNORE_ALL", PyInt_FromLong((long) PLUGIN_RC_OK_IGNORE_ALL));
|
||||
|
||||
weechat_outputs = Py_InitModule("weechatOutputs", weechat_python_output_funcs);
|
||||
if (weechat_outputs == NULL)
|
||||
{
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
WeeChat, for plugins, or both */
|
||||
#define PLUGIN_RC_OK_IGNORE_WEECHAT 1 /* ignore WeeChat for this message */
|
||||
#define PLUGIN_RC_OK_IGNORE_PLUGINS 2 /* ignore other plugins for this msg */
|
||||
#define PLUGIN_RC_OK_IGNORE_ALL (PLUGIN_RC_DISCARD_WEECHAT \
|
||||
| PLUGIN_RC_DISCARD_PLUGINS)
|
||||
#define PLUGIN_RC_OK_IGNORE_ALL (PLUGIN_RC_OK_IGNORE_WEECHAT \
|
||||
| PLUGIN_RC_OK_IGNORE_PLUGINS)
|
||||
/* ignore WeeChat and other plugins */
|
||||
|
||||
typedef struct t_plugin_dcc_info t_plugin_dcc_info;
|
||||
|
||||
Reference in New Issue
Block a user