| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1018,22 +1018,31 @@ Context_prnt(ContextObject *self, PyObject *args) | |||
| 1018 | 1018 | } | |
| 1019 | 1019 | ||
| 1020 | 1020 | static PyObject * | |
| 1021 | - Context_emit_print(ContextObject *self, PyObject *args) | ||
| 1021 | + Context_emit_print(ContextObject *self, PyObject *args, PyObject *kwargs) | ||
| 1022 | 1022 | { | |
| 1023 | - char *argv[10]; | ||
| 1023 | + char *argv[6]; | ||
| 1024 | 1024 | char *name; | |
| 1025 | 1025 | int res; | |
| 1026 | - memset(&argv, 0, sizeof(char*)*10); | ||
| 1027 | - if (!PyArg_ParseTuple(args, "s|ssssss:print_event", &name, | ||
| 1026 | + long time = 0; | ||
| 1027 | + hexchat_event_attrs *attrs; | ||
| 1028 | + char *kwlist[] = {"name", "arg1", "arg2", "arg3", | ||
| 1029 | + "arg4", "arg5", "arg6", | ||
| 1030 | + "time", NULL}; | ||
| 1031 | + memset(&argv, 0, sizeof(char*)*6); | ||
| 1032 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|ssssssl:print_event", kwlist, &name, | ||
| 1028 | 1033 | &argv[0], &argv[1], &argv[2], | |
| 1029 | 1034 | &argv[3], &argv[4], &argv[5], | |
| 1030 | - &argv[6], &argv[7], &argv[8])) | ||
| 1035 | + &time)) | ||
| 1031 | 1036 | return NULL; | |
| 1032 | 1037 | BEGIN_XCHAT_CALLS(ALLOW_THREADS); | |
| 1033 | 1038 | hexchat_set_context(ph, self->context); | |
| 1034 | - res = hexchat_emit_print(ph, name, argv[0], argv[1], argv[2], | ||
| 1035 | - argv[3], argv[4], argv[5], | ||
| 1036 | - argv[6], argv[7], argv[8]); | ||
| 1039 | + attrs = hexchat_event_attrs_create(ph); | ||
| 1040 | + attrs->server_time_utc = (time_t)time; | ||
| 1041 | + | ||
| 1042 | + res = hexchat_emit_print_attrs(ph, attrs, name, argv[0], argv[1], argv[2], | ||
| 1043 | + argv[3], argv[4], argv[5], NULL); | ||
| 1044 | + | ||
| 1045 | + hexchat_event_attrs_free(ph, attrs); | ||
| 1037 | 1046 | END_XCHAT_CALLS(); | |
| 1038 | 1047 | return PyLong_FromLong(res); | |
| 1039 | 1048 | } | |
@@ -1094,7 +1103,7 @@ static PyMethodDef Context_methods[] = { | |||
| 1094 | 1103 | {"set", (PyCFunction) Context_set, METH_NOARGS}, | |
| 1095 | 1104 | {"command", (PyCFunction) Context_command, METH_VARARGS}, | |
| 1096 | 1105 | {"prnt", (PyCFunction) Context_prnt, METH_VARARGS}, | |
| 1097 | - {"emit_print", (PyCFunction) Context_emit_print, METH_VARARGS}, | ||
| 1106 | + {"emit_print", (PyCFunction) Context_emit_print, METH_VARARGS|METH_KEYWORDS}, | ||
| 1098 | 1107 | {"get_info", (PyCFunction) Context_get_info, METH_VARARGS}, | |
| 1099 | 1108 | {"get_list", (PyCFunction) Context_get_list, METH_VARARGS}, | |
| 1100 | 1109 | {NULL, NULL} | |
@@ -1660,46 +1669,28 @@ Module_xchat_prnt(PyObject *self, PyObject *args) | |||
| 1660 | 1669 | } | |
| 1661 | 1670 | ||
| 1662 | 1671 | static PyObject * | |
| 1663 | - Module_hexchat_emit_print(PyObject *self, PyObject *args) | ||
| 1664 | - { | ||
| 1665 | - char *argv[10]; | ||
| 1666 | - char *name; | ||
| 1667 | - int res; | ||
| 1668 | - memset(&argv, 0, sizeof(char*)*10); | ||
| 1669 | - if (!PyArg_ParseTuple(args, "s|ssssss:print_event", &name, | ||
| 1670 | - &argv[0], &argv[1], &argv[2], | ||
| 1671 | - &argv[3], &argv[4], &argv[5], | ||
| 1672 | - &argv[6], &argv[7], &argv[8])) | ||
| 1673 | - return NULL; | ||
| 1674 | - BEGIN_XCHAT_CALLS(RESTORE_CONTEXT|ALLOW_THREADS); | ||
| 1675 | - res = hexchat_emit_print(ph, name, argv[0], argv[1], argv[2], | ||
| 1676 | - argv[3], argv[4], argv[5], | ||
| 1677 | - argv[6], argv[7], argv[8]); | ||
| 1678 | - END_XCHAT_CALLS(); | ||
| 1679 | - return PyLong_FromLong(res); | ||
| 1680 | - } | ||
| 1681 | - | ||
| 1682 | - static PyObject * | ||
| 1683 | - Module_hexchat_emit_print_at(PyObject *self, PyObject *args) | ||
| 1672 | + Module_hexchat_emit_print(PyObject *self, PyObject *args, PyObject *kwargs) | ||
| 1684 | 1673 | { | |
| 1685 | - char *argv[10]; | ||
| 1674 | + char *argv[6]; | ||
| 1686 | 1675 | char *name; | |
| 1687 | - long time; | ||
| 1688 | 1676 | int res; | |
| 1689 | - hexchat_event_attrs* attrs; | ||
| 1690 | - memset(&argv, 0, sizeof(char*)*10); | ||
| 1691 | - if (!PyArg_ParseTuple(args, "ls|ssssss:print_event_at", &time, &name, | ||
| 1677 | + long time = 0; | ||
| 1678 | + hexchat_event_attrs *attrs; | ||
| 1679 | + char *kwlist[] = {"name", "arg1", "arg2", "arg3", | ||
| 1680 | + "arg4", "arg5", "arg6", | ||
| 1681 | + "time", NULL}; | ||
| 1682 | + memset(&argv, 0, sizeof(char*)*6); | ||
| 1683 | + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|ssssssl:print_event", kwlist, &name, | ||
| 1692 | 1684 | &argv[0], &argv[1], &argv[2], | |
| 1693 | 1685 | &argv[3], &argv[4], &argv[5], | |
| 1694 | - &argv[6], &argv[7], &argv[8])) | ||
| 1686 | + &time)) | ||
| 1695 | 1687 | return NULL; | |
| 1696 | 1688 | BEGIN_XCHAT_CALLS(RESTORE_CONTEXT|ALLOW_THREADS); | |
| 1697 | 1689 | attrs = hexchat_event_attrs_create(ph); | |
| 1698 | - attrs->server_time_utc = (time_t)time; | ||
| 1699 | - | ||
| 1690 | + attrs->server_time_utc = (time_t)time; | ||
| 1691 | + | ||
| 1700 | 1692 | res = hexchat_emit_print_attrs(ph, attrs, name, argv[0], argv[1], argv[2], | |
| 1701 | - argv[3], argv[4], argv[5], | ||
| 1702 | - argv[6], argv[7], argv[8]); | ||
| 1693 | + argv[3], argv[4], argv[5], NULL); | ||
| 1703 | 1694 | ||
| 1704 | 1695 | hexchat_event_attrs_free(ph, attrs); | |
| 1705 | 1696 | END_XCHAT_CALLS(); | |
@@ -2314,10 +2305,8 @@ static PyMethodDef Module_xchat_methods[] = { | |||
| 2314 | 2305 | METH_VARARGS}, | |
| 2315 | 2306 | {"prnt", Module_xchat_prnt, | |
| 2316 | 2307 | METH_VARARGS}, | |
| 2317 | - {"emit_print", Module_hexchat_emit_print, | ||
| 2318 | - METH_VARARGS}, | ||
| 2319 | - {"emit_print_at", Module_hexchat_emit_print_at, | ||
| 2320 | - METH_VARARGS}, | ||
| 2308 | + {"emit_print", (PyCFunction)Module_hexchat_emit_print, | ||
| 2309 | + METH_VARARGS|METH_KEYWORDS}, | ||
| 2321 | 2310 | {"get_info", Module_hexchat_get_info, | |
| 2322 | 2311 | METH_VARARGS}, | |
| 2323 | 2312 | {"get_prefs", Module_xchat_get_prefs, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments