mirror of
https://github.com/weechat/weechat.git
synced 2026-06-26 04:46:37 +02:00
Added "copy" and "rename" options to /server command
This commit is contained in:
@@ -1672,8 +1672,8 @@ weechat_lua_get_server_info (lua_State *L)
|
||||
lua_pushnumber (lua_current_interpreter, ptr_server->autoreconnect_delay);
|
||||
lua_rawset (lua_current_interpreter, -3);
|
||||
|
||||
lua_pushstring (lua_current_interpreter, "command_line");
|
||||
lua_pushnumber (lua_current_interpreter, ptr_server->command_line);
|
||||
lua_pushstring (lua_current_interpreter, "temp_server");
|
||||
lua_pushnumber (lua_current_interpreter, ptr_server->temp_server);
|
||||
lua_rawset (lua_current_interpreter, -3);
|
||||
|
||||
lua_pushstring (lua_current_interpreter, "address");
|
||||
@@ -1973,7 +1973,7 @@ weechat_lua_get_irc_color (lua_State *L)
|
||||
static int
|
||||
weechat_lua_get_window_info (lua_State *L)
|
||||
{
|
||||
t_plugin_window_info *window_info, *ptr_window;
|
||||
t_plugin_window_info *window_info, *ptr_win;
|
||||
int i;
|
||||
|
||||
/* make C compiler happy */
|
||||
@@ -1997,40 +1997,43 @@ weechat_lua_get_window_info (lua_State *L)
|
||||
|
||||
lua_newtable (lua_current_interpreter);
|
||||
|
||||
for (i = 0, ptr_window = window_info; ptr_window; ptr_window = ptr_window->next_window, i++)
|
||||
i = 0;
|
||||
for (ptr_win = window_info; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
lua_pushnumber (lua_current_interpreter, i);
|
||||
lua_newtable (lua_current_interpreter);
|
||||
|
||||
lua_pushstring (lua_current_interpreter, "num_buffer");
|
||||
lua_pushnumber (lua_current_interpreter, ptr_window->num_buffer);
|
||||
lua_pushnumber (lua_current_interpreter, ptr_win->num_buffer);
|
||||
lua_rawset (lua_current_interpreter, -3);
|
||||
|
||||
lua_pushstring (lua_current_interpreter, "win_x");
|
||||
lua_pushnumber (lua_current_interpreter, ptr_window->win_x);
|
||||
lua_pushnumber (lua_current_interpreter, ptr_win->win_x);
|
||||
lua_rawset (lua_current_interpreter, -3);
|
||||
|
||||
lua_pushstring (lua_current_interpreter, "win_y");
|
||||
lua_pushnumber (lua_current_interpreter, ptr_window->win_y);
|
||||
lua_pushnumber (lua_current_interpreter, ptr_win->win_y);
|
||||
lua_rawset (lua_current_interpreter, -3);
|
||||
|
||||
lua_pushstring (lua_current_interpreter, "win_width");
|
||||
lua_pushnumber (lua_current_interpreter, ptr_window->win_width);
|
||||
lua_pushnumber (lua_current_interpreter, ptr_win->win_width);
|
||||
lua_rawset (lua_current_interpreter, -3);
|
||||
|
||||
lua_pushstring (lua_current_interpreter, "win_height");
|
||||
lua_pushnumber (lua_current_interpreter, ptr_window->win_height);
|
||||
lua_pushnumber (lua_current_interpreter, ptr_win->win_height);
|
||||
lua_rawset (lua_current_interpreter, -3);
|
||||
|
||||
lua_pushstring (lua_current_interpreter, "win_width_pct");
|
||||
lua_pushnumber (lua_current_interpreter, ptr_window->win_width_pct);
|
||||
lua_pushnumber (lua_current_interpreter, ptr_win->win_width_pct);
|
||||
lua_rawset (lua_current_interpreter, -3);
|
||||
|
||||
lua_pushstring (lua_current_interpreter, "win_height_pct");
|
||||
lua_pushnumber (lua_current_interpreter, ptr_window->win_height_pct);
|
||||
lua_pushnumber (lua_current_interpreter, ptr_win->win_height_pct);
|
||||
lua_rawset (lua_current_interpreter, -3);
|
||||
|
||||
lua_rawset (lua_current_interpreter, -3);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
lua_plugin->free_window_info (lua_plugin, window_info);
|
||||
|
||||
@@ -1465,7 +1465,7 @@ static XS (XS_weechat_get_server_info)
|
||||
hv_store (server_hash_member, "autoconnect", 11, newSViv (ptr_server->autoconnect), 0);
|
||||
hv_store (server_hash_member, "autoreconnect", 13, newSViv (ptr_server->autoreconnect), 0);
|
||||
hv_store (server_hash_member, "autoreconnect_delay", 19, newSViv (ptr_server->autoreconnect_delay), 0);
|
||||
hv_store (server_hash_member, "command_line", 12, newSViv (ptr_server->command_line), 0);
|
||||
hv_store (server_hash_member, "temp_server", 11, newSViv (ptr_server->temp_server), 0);
|
||||
hv_store (server_hash_member, "address", 7, newSVpv (ptr_server->address, 0), 0);
|
||||
hv_store (server_hash_member, "port", 4, newSViv (ptr_server->port), 0);
|
||||
hv_store (server_hash_member, "ipv6", 4, newSViv (ptr_server->ipv6), 0);
|
||||
@@ -1717,7 +1717,7 @@ static XS (XS_weechat_get_irc_color)
|
||||
|
||||
static XS (XS_weechat_get_window_info)
|
||||
{
|
||||
t_plugin_window_info *window_info, *ptr_window;
|
||||
t_plugin_window_info *window_info, *ptr_win;
|
||||
int count;
|
||||
HV *window_hash_member;
|
||||
dXSARGS;
|
||||
@@ -1739,17 +1739,17 @@ static XS (XS_weechat_get_window_info)
|
||||
if (!window_info)
|
||||
XSRETURN_EMPTY;
|
||||
|
||||
for (ptr_window = window_info; ptr_window; ptr_window = ptr_window->next_window)
|
||||
for (ptr_win = window_info; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
window_hash_member = (HV *) sv_2mortal((SV *) newHV());
|
||||
|
||||
hv_store (window_hash_member, "num_buffer", 10, newSViv (ptr_window->num_buffer), 0);
|
||||
hv_store (window_hash_member, "win_x", 5, newSViv (ptr_window->win_x), 0);
|
||||
hv_store (window_hash_member, "win_y", 5, newSViv (ptr_window->win_y), 0);
|
||||
hv_store (window_hash_member, "win_width", 9, newSViv (ptr_window->win_width), 0);
|
||||
hv_store (window_hash_member, "win_height", 10, newSViv (ptr_window->win_height), 0);
|
||||
hv_store (window_hash_member, "win_width_pct", 13, newSViv (ptr_window->win_width_pct), 0);
|
||||
hv_store (window_hash_member, "win_height_pct", 14, newSViv (ptr_window->win_height_pct), 0);
|
||||
hv_store (window_hash_member, "num_buffer", 10, newSViv (ptr_win->num_buffer), 0);
|
||||
hv_store (window_hash_member, "win_x", 5, newSViv (ptr_win->win_x), 0);
|
||||
hv_store (window_hash_member, "win_y", 5, newSViv (ptr_win->win_y), 0);
|
||||
hv_store (window_hash_member, "win_width", 9, newSViv (ptr_win->win_width), 0);
|
||||
hv_store (window_hash_member, "win_height", 10, newSViv (ptr_win->win_height), 0);
|
||||
hv_store (window_hash_member, "win_width_pct", 13, newSViv (ptr_win->win_width_pct), 0);
|
||||
hv_store (window_hash_member, "win_height_pct", 14, newSViv (ptr_win->win_height_pct), 0);
|
||||
|
||||
XPUSHs(newRV_inc((SV *) window_hash_member));
|
||||
count++;
|
||||
|
||||
@@ -1495,8 +1495,8 @@ weechat_python_get_server_info (PyObject *self, PyObject *args)
|
||||
Py_DECREF (key);
|
||||
Py_DECREF (value);
|
||||
|
||||
key = Py_BuildValue("s", "command_line");
|
||||
value = Py_BuildValue("i", ptr_server->command_line);
|
||||
key = Py_BuildValue("s", "temp_server");
|
||||
value = Py_BuildValue("i", ptr_server->temp_server);
|
||||
PyDict_SetItem(server_hash_member, key, value);
|
||||
Py_DECREF (key);
|
||||
Py_DECREF (value);
|
||||
@@ -1856,7 +1856,7 @@ weechat_python_get_irc_color (PyObject *self, PyObject *args)
|
||||
static PyObject *
|
||||
weechat_python_get_window_info (PyObject *self, PyObject *args)
|
||||
{
|
||||
t_plugin_window_info *window_info, *ptr_window;
|
||||
t_plugin_window_info *window_info, *ptr_win;
|
||||
PyObject *window_list, *window_list_member, *key, *value;
|
||||
|
||||
/* make C compiler happy */
|
||||
@@ -1879,53 +1879,53 @@ weechat_python_get_window_info (PyObject *self, PyObject *args)
|
||||
}
|
||||
|
||||
window_info = python_plugin->get_window_info (python_plugin);
|
||||
if (!window_info)
|
||||
if (!window_info)
|
||||
return window_list;
|
||||
|
||||
for(ptr_window = window_info; ptr_window; ptr_window = ptr_window->next_window)
|
||||
for (ptr_win = window_info; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
window_list_member = PyDict_New();
|
||||
|
||||
if (window_list_member)
|
||||
{
|
||||
key = Py_BuildValue("s", "num_buffer");
|
||||
value = Py_BuildValue("i", ptr_window->num_buffer);
|
||||
value = Py_BuildValue("i", ptr_win->num_buffer);
|
||||
PyDict_SetItem(window_list_member, key, value);
|
||||
Py_DECREF (key);
|
||||
Py_DECREF (value);
|
||||
|
||||
key = Py_BuildValue("s", "win_x");
|
||||
value = Py_BuildValue("i", ptr_window->win_x);
|
||||
value = Py_BuildValue("i", ptr_win->win_x);
|
||||
PyDict_SetItem(window_list_member, key, value);
|
||||
Py_DECREF (key);
|
||||
Py_DECREF (value);
|
||||
|
||||
key = Py_BuildValue("s", "win_y");
|
||||
value = Py_BuildValue("i", ptr_window->win_y);
|
||||
value = Py_BuildValue("i", ptr_win->win_y);
|
||||
PyDict_SetItem(window_list_member, key, value);
|
||||
Py_DECREF (key);
|
||||
Py_DECREF (value);
|
||||
|
||||
key = Py_BuildValue("s", "win_width");
|
||||
value = Py_BuildValue("i", ptr_window->win_width);
|
||||
value = Py_BuildValue("i", ptr_win->win_width);
|
||||
PyDict_SetItem(window_list_member, key, value);
|
||||
Py_DECREF (key);
|
||||
Py_DECREF (value);
|
||||
|
||||
key = Py_BuildValue("s", "win_height");
|
||||
value = Py_BuildValue("i", ptr_window->win_height);
|
||||
value = Py_BuildValue("i", ptr_win->win_height);
|
||||
PyDict_SetItem(window_list_member, key, value);
|
||||
Py_DECREF (key);
|
||||
Py_DECREF (value);
|
||||
|
||||
key = Py_BuildValue("s", "win_width_pct");
|
||||
value = Py_BuildValue("i", ptr_window->win_width_pct);
|
||||
value = Py_BuildValue("i", ptr_win->win_width_pct);
|
||||
PyDict_SetItem(window_list_member, key, value);
|
||||
Py_DECREF (key);
|
||||
Py_DECREF (value);
|
||||
|
||||
key = Py_BuildValue("s", "win_height_pct");
|
||||
value = Py_BuildValue("i", ptr_window->win_height_pct);
|
||||
value = Py_BuildValue("i", ptr_win->win_height_pct);
|
||||
PyDict_SetItem(window_list_member, key, value);
|
||||
Py_DECREF (key);
|
||||
Py_DECREF (value);
|
||||
|
||||
@@ -1669,8 +1669,8 @@ weechat_ruby_get_server_info (VALUE class)
|
||||
INT2FIX(ptr_server->autoreconnect));
|
||||
rb_hash_aset (server_hash_member, rb_str_new2("autoreconnect_delay"),
|
||||
INT2FIX(ptr_server->autoreconnect_delay));
|
||||
rb_hash_aset (server_hash_member, rb_str_new2("command_line"),
|
||||
INT2FIX(ptr_server->command_line));
|
||||
rb_hash_aset (server_hash_member, rb_str_new2("temp_server"),
|
||||
INT2FIX(ptr_server->temp_server));
|
||||
rb_hash_aset (server_hash_member, rb_str_new2("address"),
|
||||
rb_str_new2(ptr_server->address));
|
||||
rb_hash_aset (server_hash_member, rb_str_new2("port"),
|
||||
@@ -1910,7 +1910,7 @@ weechat_ruby_get_irc_color (VALUE class, VALUE color)
|
||||
static VALUE
|
||||
weechat_ruby_get_window_info (VALUE class)
|
||||
{
|
||||
t_plugin_window_info *window_info, *ptr_window;
|
||||
t_plugin_window_info *window_info, *ptr_win;
|
||||
VALUE window_list, window_list_member;
|
||||
|
||||
/* make C compiler happy */
|
||||
@@ -1933,26 +1933,26 @@ weechat_ruby_get_window_info (VALUE class)
|
||||
if (!window_info)
|
||||
return window_list;
|
||||
|
||||
for(ptr_window = window_info; ptr_window; ptr_window = ptr_window->next_window)
|
||||
for (ptr_win = window_info; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
window_list_member = rb_hash_new ();
|
||||
|
||||
if (!NIL_P (window_list_member))
|
||||
{
|
||||
rb_hash_aset (window_list_member, rb_str_new2("num_buffer"),
|
||||
INT2FIX(ptr_window->num_buffer));
|
||||
INT2FIX(ptr_win->num_buffer));
|
||||
rb_hash_aset (window_list_member, rb_str_new2("win_x"),
|
||||
INT2FIX(ptr_window->win_x));
|
||||
INT2FIX(ptr_win->win_x));
|
||||
rb_hash_aset (window_list_member, rb_str_new2("win_y"),
|
||||
INT2FIX(ptr_window->win_y));
|
||||
INT2FIX(ptr_win->win_y));
|
||||
rb_hash_aset (window_list_member, rb_str_new2("win_width"),
|
||||
INT2FIX(ptr_window->win_width));
|
||||
INT2FIX(ptr_win->win_width));
|
||||
rb_hash_aset (window_list_member, rb_str_new2("win_height"),
|
||||
INT2FIX(ptr_window->win_height));
|
||||
INT2FIX(ptr_win->win_height));
|
||||
rb_hash_aset (window_list_member, rb_str_new2("win_width_pct"),
|
||||
INT2FIX(ptr_window->win_width_pct));
|
||||
INT2FIX(ptr_win->win_width_pct));
|
||||
rb_hash_aset (window_list_member, rb_str_new2("win_height_pct"),
|
||||
INT2FIX(ptr_window->win_height_pct));
|
||||
INT2FIX(ptr_win->win_height_pct));
|
||||
|
||||
rb_ary_push (window_list, window_list_member);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user