456 |
|
|
457 |
return list; |
return list; |
458 |
} |
} |
459 |
|
|
460 |
|
/* |
461 |
|
* weechat.get_config: get value of a config option |
462 |
|
*/ |
463 |
|
|
464 |
|
static PyObject * |
465 |
|
weechat_python_get_config (PyObject *self, PyObject *args) |
466 |
|
{ |
467 |
|
char *option, *value; |
468 |
|
PyObject *object; |
469 |
|
|
470 |
|
/* make gcc happy */ |
471 |
|
(void) self; |
472 |
|
|
473 |
|
if (!PyArg_ParseTuple (args, "s", &option)) |
474 |
|
{ |
475 |
|
python_plugin->printf_server (python_plugin, |
476 |
|
"Python error: wrong parameters for " |
477 |
|
"\"get_config\" function"); |
478 |
|
return NULL; |
479 |
|
} |
480 |
|
|
481 |
|
if (option) |
482 |
|
{ |
483 |
|
value = python_plugin->get_config (python_plugin, option); |
484 |
|
|
485 |
|
if (value) |
486 |
|
{ |
487 |
|
object = Py_BuildValue ("s", value); |
488 |
|
free (value); |
489 |
|
return object; |
490 |
|
} |
491 |
|
else |
492 |
|
return Py_BuildValue ("s", ""); |
493 |
|
} |
494 |
|
|
495 |
|
return Py_BuildValue ("i", 1); |
496 |
|
} |
497 |
|
|
498 |
/* |
/* |
499 |
* Python subroutines |
* Python subroutines |
509 |
{ "add_command_handler", weechat_python_add_command_handler, METH_VARARGS, "" }, |
{ "add_command_handler", weechat_python_add_command_handler, METH_VARARGS, "" }, |
510 |
{ "get_info", weechat_python_get_info, METH_VARARGS, "" }, |
{ "get_info", weechat_python_get_info, METH_VARARGS, "" }, |
511 |
{ "get_dcc_info", weechat_python_get_dcc_info, METH_VARARGS, "" }, |
{ "get_dcc_info", weechat_python_get_dcc_info, METH_VARARGS, "" }, |
512 |
|
{ "get_config", weechat_python_get_config, METH_VARARGS, "" }, |
513 |
{ NULL, NULL, 0, NULL } |
{ NULL, NULL, 0, NULL } |
514 |
}; |
}; |
515 |
|
|