From 1bc997b23854f109e1b4b3644214a7e405e73d11 Mon Sep 17 00:00:00 2001 From: Emmanuel Bouthenot Date: Sat, 8 Apr 2006 21:37:26 +0000 Subject: [PATCH] Fix possible minor bug in getting hostnames in plugins/scripts --- src/plugins/scripts/lua/weechat-lua.c | 3 ++- src/plugins/scripts/perl/weechat-perl.c | 3 ++- src/plugins/scripts/python/weechat-python.c | 2 +- src/plugins/scripts/ruby/weechat-ruby.c | 2 +- weechat/src/plugins/scripts/lua/weechat-lua.c | 3 ++- weechat/src/plugins/scripts/perl/weechat-perl.c | 3 ++- weechat/src/plugins/scripts/python/weechat-python.c | 2 +- weechat/src/plugins/scripts/ruby/weechat-ruby.c | 2 +- 8 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/plugins/scripts/lua/weechat-lua.c b/src/plugins/scripts/lua/weechat-lua.c index a10711385..31425d12c 100644 --- a/src/plugins/scripts/lua/weechat-lua.c +++ b/src/plugins/scripts/lua/weechat-lua.c @@ -1490,7 +1490,8 @@ weechat_lua_get_nick_info (lua_State *L) lua_rawset (lua_current_interpreter, -3); lua_pushstring (lua_current_interpreter, "host"); - lua_pushstring (lua_current_interpreter, ptr_nick->host); + lua_pushstring (lua_current_interpreter, + ptr_nick->host ? ptr_nick->host : ""); lua_rawset (lua_current_interpreter, -3); lua_rawset (lua_current_interpreter, -3); diff --git a/src/plugins/scripts/perl/weechat-perl.c b/src/plugins/scripts/perl/weechat-perl.c index 4bbddebb6..a3f8324be 100644 --- a/src/plugins/scripts/perl/weechat-perl.c +++ b/src/plugins/scripts/perl/weechat-perl.c @@ -1281,7 +1281,8 @@ static XS (XS_weechat_get_nick_info) HV *nick_hash_member = (HV *) sv_2mortal((SV *) newHV()); hv_store (nick_hash_member, "flags", 5, newSViv (ptr_nick->flags), 0); - hv_store (nick_hash_member, "host", 4, newSVpv (ptr_nick->host, 0), 0); + hv_store (nick_hash_member, "host", 4, newSVpv ( + ptr_nick->host ? ptr_nick->host : "", 0), 0); hv_store (nick_hash, ptr_nick->nick, strlen(ptr_nick->nick), newRV_inc((SV *) nick_hash_member), 0); } diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c index ee089fa9c..4e50072a7 100644 --- a/src/plugins/scripts/python/weechat-python.c +++ b/src/plugins/scripts/python/weechat-python.c @@ -1231,7 +1231,7 @@ weechat_python_get_nick_info (PyObject *self, PyObject *args) PyDict_SetItem(nick_hash_member, Py_BuildValue("s", "flags"), Py_BuildValue("i", ptr_nick->flags)); PyDict_SetItem(nick_hash_member, Py_BuildValue("s", "host"), - Py_BuildValue("s", ptr_nick->host)); + Py_BuildValue("s", ptr_nick->host ? ptr_nick->host : "")); PyDict_SetItem(nick_hash, Py_BuildValue("s", ptr_nick->nick), nick_hash_member); } diff --git a/src/plugins/scripts/ruby/weechat-ruby.c b/src/plugins/scripts/ruby/weechat-ruby.c index 45d066cf0..c648dd58f 100644 --- a/src/plugins/scripts/ruby/weechat-ruby.c +++ b/src/plugins/scripts/ruby/weechat-ruby.c @@ -1471,7 +1471,7 @@ weechat_ruby_get_nick_info (VALUE class, VALUE server, VALUE channel) rb_hash_aset (nick_hash_member, rb_str_new2("flags"), INT2FIX(ptr_nick->flags)); rb_hash_aset (nick_hash_member, rb_str_new2("host"), - rb_str_new2(ptr_nick->host)); + rb_str_new2(ptr_nick->host ? ptr_nick->host : "")); rb_hash_aset (nick_hash, rb_str_new2(ptr_nick->nick), nick_hash_member); } diff --git a/weechat/src/plugins/scripts/lua/weechat-lua.c b/weechat/src/plugins/scripts/lua/weechat-lua.c index a10711385..31425d12c 100644 --- a/weechat/src/plugins/scripts/lua/weechat-lua.c +++ b/weechat/src/plugins/scripts/lua/weechat-lua.c @@ -1490,7 +1490,8 @@ weechat_lua_get_nick_info (lua_State *L) lua_rawset (lua_current_interpreter, -3); lua_pushstring (lua_current_interpreter, "host"); - lua_pushstring (lua_current_interpreter, ptr_nick->host); + lua_pushstring (lua_current_interpreter, + ptr_nick->host ? ptr_nick->host : ""); lua_rawset (lua_current_interpreter, -3); lua_rawset (lua_current_interpreter, -3); diff --git a/weechat/src/plugins/scripts/perl/weechat-perl.c b/weechat/src/plugins/scripts/perl/weechat-perl.c index 4bbddebb6..a3f8324be 100644 --- a/weechat/src/plugins/scripts/perl/weechat-perl.c +++ b/weechat/src/plugins/scripts/perl/weechat-perl.c @@ -1281,7 +1281,8 @@ static XS (XS_weechat_get_nick_info) HV *nick_hash_member = (HV *) sv_2mortal((SV *) newHV()); hv_store (nick_hash_member, "flags", 5, newSViv (ptr_nick->flags), 0); - hv_store (nick_hash_member, "host", 4, newSVpv (ptr_nick->host, 0), 0); + hv_store (nick_hash_member, "host", 4, newSVpv ( + ptr_nick->host ? ptr_nick->host : "", 0), 0); hv_store (nick_hash, ptr_nick->nick, strlen(ptr_nick->nick), newRV_inc((SV *) nick_hash_member), 0); } diff --git a/weechat/src/plugins/scripts/python/weechat-python.c b/weechat/src/plugins/scripts/python/weechat-python.c index ee089fa9c..4e50072a7 100644 --- a/weechat/src/plugins/scripts/python/weechat-python.c +++ b/weechat/src/plugins/scripts/python/weechat-python.c @@ -1231,7 +1231,7 @@ weechat_python_get_nick_info (PyObject *self, PyObject *args) PyDict_SetItem(nick_hash_member, Py_BuildValue("s", "flags"), Py_BuildValue("i", ptr_nick->flags)); PyDict_SetItem(nick_hash_member, Py_BuildValue("s", "host"), - Py_BuildValue("s", ptr_nick->host)); + Py_BuildValue("s", ptr_nick->host ? ptr_nick->host : "")); PyDict_SetItem(nick_hash, Py_BuildValue("s", ptr_nick->nick), nick_hash_member); } diff --git a/weechat/src/plugins/scripts/ruby/weechat-ruby.c b/weechat/src/plugins/scripts/ruby/weechat-ruby.c index 45d066cf0..c648dd58f 100644 --- a/weechat/src/plugins/scripts/ruby/weechat-ruby.c +++ b/weechat/src/plugins/scripts/ruby/weechat-ruby.c @@ -1471,7 +1471,7 @@ weechat_ruby_get_nick_info (VALUE class, VALUE server, VALUE channel) rb_hash_aset (nick_hash_member, rb_str_new2("flags"), INT2FIX(ptr_nick->flags)); rb_hash_aset (nick_hash_member, rb_str_new2("host"), - rb_str_new2(ptr_nick->host)); + rb_str_new2(ptr_nick->host ? ptr_nick->host : "")); rb_hash_aset (nick_hash, rb_str_new2(ptr_nick->nick), nick_hash_member); }