fix crash when obtaining the number of users. ok from martynas@ some time ago.
while i'm here remove some unneeded printf's and fix the reply users callback. bump package.
This commit is contained in:
parent
10075a6267
commit
629c8da8bf
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.7 2007/10/08 08:22:40 steven Exp $
|
||||
# $OpenBSD: Makefile,v 1.8 2008/03/23 05:46:29 fgsch Exp $
|
||||
|
||||
SHARED_ONLY= Yes
|
||||
|
||||
@ -6,7 +6,7 @@ COMMENT= Python bindings for the SILC toolkit
|
||||
|
||||
V= 0.4
|
||||
DISTNAME= pysilc-${V}
|
||||
PKGNAME= py-silc-${V}p2v0
|
||||
PKGNAME= py-silc-${V}p3v0
|
||||
CATEGORIES= devel
|
||||
|
||||
HOMEPAGE= http://www.liquidx.net/pysilc/
|
||||
|
@ -1,6 +1,6 @@
|
||||
$OpenBSD: patch-examples_demo_py,v 1.3 2007/10/02 17:35:48 martynas Exp $
|
||||
--- examples/demo.py.orig Mon Jul 10 02:57:15 2006
|
||||
+++ examples/demo.py Sun Jul 1 22:52:11 2007
|
||||
$OpenBSD: patch-examples_demo_py,v 1.4 2008/03/23 05:46:29 fgsch Exp $
|
||||
--- examples/demo.py.orig Mon Jul 10 00:57:15 2006
|
||||
+++ examples/demo.py Sun Mar 23 05:36:57 2008
|
||||
@@ -29,6 +29,10 @@ class SupySilcClient(silc.SilcClient):
|
||||
def _cache_channel(self, channel):
|
||||
self.channels[channel.channel_name] = channel
|
||||
@ -12,7 +12,19 @@ $OpenBSD: patch-examples_demo_py,v 1.3 2007/10/02 17:35:48 martynas Exp $
|
||||
def connected(self):
|
||||
print 'SILC: Connected to server.'
|
||||
self.isconnected = True
|
||||
@@ -209,7 +213,6 @@ class SupySilcClient(silc.SilcClient):
|
||||
@@ -195,8 +199,9 @@ class SupySilcClient(silc.SilcClient):
|
||||
print 'SILC: Reply (Leave):', channel
|
||||
|
||||
def command_reply_users(self, channel, users):
|
||||
- self._cache_user(user)
|
||||
- print 'SILC: Reply (Users):', type, user
|
||||
+ for user in users:
|
||||
+ self._cache_user(user)
|
||||
+ print 'SILC: Reply (Users):', channel, users
|
||||
|
||||
def command_reply_service(self, *args):
|
||||
pass # not implemented
|
||||
@@ -209,7 +214,6 @@ class SupySilcClient(silc.SilcClient):
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
c = SupySilcClient()
|
||||
|
@ -1,6 +1,6 @@
|
||||
$OpenBSD: patch-src_pysilc_callbacks_c,v 1.3 2007/10/02 17:35:48 martynas Exp $
|
||||
--- src/pysilc_callbacks.c.orig Sun Jul 9 20:18:27 2006
|
||||
+++ src/pysilc_callbacks.c Sun Jul 1 22:52:11 2007
|
||||
$OpenBSD: patch-src_pysilc_callbacks_c,v 1.4 2008/03/23 05:46:29 fgsch Exp $
|
||||
--- src/pysilc_callbacks.c.orig Sun Jul 9 18:18:27 2006
|
||||
+++ src/pysilc_callbacks.c Sun Mar 23 05:38:15 2008
|
||||
@@ -46,6 +46,81 @@
|
||||
#define PYSILC_SILCBUFFER_TO_PYLIST(source, destination, Type) \
|
||||
do { } while (0);
|
||||
@ -466,7 +466,15 @@ $OpenBSD: patch-src_pysilc_callbacks_c,v 1.3 2007/10/02 17:35:48 martynas Exp $
|
||||
Py_DECREF(callback);
|
||||
return;
|
||||
}
|
||||
@@ -696,14 +807,11 @@ static void _pysilc_client_callback_command_reply(Silc
|
||||
@@ -677,7 +788,6 @@ static void _pysilc_client_callback_command_reply(Silc
|
||||
case SILC_COMMAND_PING:
|
||||
{
|
||||
PYSILC_GET_CALLBACK_OR_BREAK("command_reply_ping");
|
||||
- printf("command ping callback found\n") ;
|
||||
if ((result = PyObject_CallObject(callback, args)) == 0)
|
||||
PyErr_Print();
|
||||
break;
|
||||
@@ -696,14 +806,11 @@ static void _pysilc_client_callback_command_reply(Silc
|
||||
memset(context, 0, sizeof(PySilcClient_Callback_Join_Context));
|
||||
if (!context)
|
||||
break;
|
||||
@ -483,7 +491,7 @@ $OpenBSD: patch-src_pysilc_callbacks_c,v 1.3 2007/10/02 17:35:48 martynas Exp $
|
||||
tmpstr = va_arg(va, char *);
|
||||
if (tmpstr)
|
||||
context->channel_name = strdup(tmpstr);
|
||||
@@ -711,27 +819,19 @@ static void _pysilc_client_callback_command_reply(Silc
|
||||
@@ -711,27 +818,19 @@ static void _pysilc_client_callback_command_reply(Silc
|
||||
context->pychannel = pychannel;
|
||||
Py_INCREF(pychannel);
|
||||
context->channel_mode = va_arg(va, SilcUInt32);
|
||||
@ -517,7 +525,23 @@ $OpenBSD: patch-src_pysilc_callbacks_c,v 1.3 2007/10/02 17:35:48 martynas Exp $
|
||||
break;
|
||||
}
|
||||
case SILC_COMMAND_MOTD:
|
||||
@@ -846,7 +946,7 @@ static void _pysilc_client_callback_command_reply(Silc
|
||||
@@ -832,21 +931,19 @@ static void _pysilc_client_callback_command_reply(Silc
|
||||
PYSILC_NEW_CHANNEL_OR_BREAK(va_arg(va, SilcChannelEntry), pychannel);
|
||||
|
||||
// get all users from this channel .. tedious
|
||||
- SilcUInt32 user_count = va_arg(va, SilcUInt32);
|
||||
- pyuser = PyTuple_New(user_count); // hijack pyuser so we get autocleanup
|
||||
int i = 0;
|
||||
SilcHashTableList hash_list;
|
||||
SilcClientEntry user, cached;
|
||||
SilcChannelUser user_channel;
|
||||
PyObject *u = NULL;
|
||||
SilcChannelEntry channel = ((PySilcChannel *)pychannel)->silcobj;
|
||||
+ SilcUInt32 user_count = silc_hash_table_count(channel->user_list);
|
||||
+ pyuser = PyTuple_New(user_count); // hijack pyuser so we get autocleanup
|
||||
|
||||
- printf("user: %d\n", user_count);
|
||||
-
|
||||
if (channel && channel->user_list) {
|
||||
silc_hash_table_list(channel->user_list, &hash_list);
|
||||
while (silc_hash_table_get(&hash_list, (void *)&user, (void *)&user_channel)) {
|
||||
@ -526,7 +550,7 @@ $OpenBSD: patch-src_pysilc_callbacks_c,v 1.3 2007/10/02 17:35:48 martynas Exp $
|
||||
if (cached) {
|
||||
u = PySilcUser_New(cached);
|
||||
PyTuple_SetItem(pyuser, i, u);
|
||||
@@ -880,60 +980,37 @@ cleanup:
|
||||
@@ -880,60 +977,37 @@ cleanup:
|
||||
Py_XDECREF(pyuser);
|
||||
}
|
||||
|
||||
@ -602,7 +626,7 @@ $OpenBSD: patch-src_pysilc_callbacks_c,v 1.3 2007/10/02 17:35:48 martynas Exp $
|
||||
}
|
||||
|
||||
static void _pysilc_client_callback_ftp(SilcClient client,
|
||||
@@ -973,25 +1050,3 @@ cleanup:
|
||||
@@ -973,25 +1047,3 @@ cleanup:
|
||||
Py_XDECREF(callback);
|
||||
Py_XDECREF(result);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user