[wpdev-commits] wolfpack/python item.cpp,1.72,1.73 pypacket.cpp,1.3,1.4
Brought to you by:
rip,
thiagocorrea
|
From: <dar...@us...> - 2003-08-30 17:00:20
|
Update of /cvsroot/wpdev/wolfpack/python
In directory sc8-pr-cvs1:/tmp/cvs-serv10846/python
Modified Files:
item.cpp pypacket.cpp
Log Message:
Removed Books and Fixed Packetlengths.
Index: item.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/item.cpp,v
retrieving revision 1.72
retrieving revision 1.73
diff -C2 -d -r1.72 -r1.73
*** item.cpp 27 Aug 2003 13:33:18 -0000 1.72
--- item.cpp 30 Aug 2003 17:00:13 -0000 1.73
***************
*** 38,42 ****
#include "../itemid.h"
#include "../multis.h"
- #include "../books.h"
#include "../basechar.h"
#include "../singleton.h"
--- 38,41 ----
***************
*** 673,692 ****
if( !strcmp( "content", name ) )
{
- cBook* pBook = dynamic_cast< cBook* >(self->pItem);
- if( pBook )
- {
- QStringList content = pBook->content();
- QStringList::iterator it = content.begin();
- PyObject *list = PyList_New( content.size() );
- UINT32 i = 0;
- while( it != content.end() )
- {
- PyList_SetItem( list, i, PyString_FromString( *it ) );
- ++it;
- ++i;
- }
- return list;
- }
-
cItem::ContainerContent content = self->pItem->content();
PyObject *list = PyList_New( content.size() );
--- 672,675 ----
***************
*** 802,829 ****
self->pItem->removeFromCont();
self->pItem->moveTo( self->pItem->pos() );
- }
- }
- else if( !strcmp( "content", name ) )
- {
- cBook* pBook = dynamic_cast< cBook* >( self->pItem );
- if( pBook && PyList_Check( value ) )
- {
- QStringList content;
- UINT32 i;
- for( i = 0; i < PyList_Size( value ); ++i )
- {
- if( !PyString_Check( PyList_GetItem( value, i ) ) )
- {
- content.push_back("");
- continue;
- }
-
- content.push_back( PyString_AsString( PyList_GetItem( value, i ) ) );
- }
- }
- else
- {
- PyErr_BadArgument();
- return -1;
}
}
--- 785,788 ----
Index: pypacket.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/pypacket.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** pypacket.cpp 10 Aug 2003 04:26:42 -0000 1.3
--- pypacket.cpp 30 Aug 2003 17:00:13 -0000 1.4
***************
*** 125,137 ****
static PyObject *wpPacket_setascii( PyObject *self, PyObject *args )
{
! int pos, size;
char *buffer;
! if( !PyArg_ParseTuple( args, "ies#:wppacket.setbuffer( position, value )", &pos, "ascii", &buffer, &size ) )
return 0;
! ( (wpPacket*)self )->packet->setAsciiString( (unsigned short)pos, buffer, size );
!
! PyMem_Free( buffer );
Py_INCREF( Py_None );
--- 125,135 ----
static PyObject *wpPacket_setascii( PyObject *self, PyObject *args )
{
! int pos;
char *buffer;
! if( !PyArg_ParseTuple( args, "ies:wppacket.setbuffer( position, value )", &pos, "ascii", &buffer ) )
return 0;
! ( (wpPacket*)self )->packet->setAsciiString( (unsigned short)pos, buffer, strlen( buffer ) + 1 );
Py_INCREF( Py_None );
***************
*** 172,175 ****
--- 170,181 ----
}
+ // Return a Packet Dump
+ static PyObject *wpPacket_dump( PyObject *self, PyObject *args )
+ {
+ QCString dump = cUOPacket::dump( ( (wpPacket*)self )->packet->uncompressed() );
+
+ return PyString_FromString( dump.data() );
+ }
+
// List of Methods
PyMethodDef wpPacketMethods[] =
***************
*** 182,185 ****
--- 188,192 ----
{ "setunicode", wpPacket_setunicode, METH_VARARGS, NULL },
{ "send", wpPacket_send, METH_VARARGS, NULL },
+ { "dump", wpPacket_dump, METH_VARARGS, NULL },
{ NULL, NULL, 0, NULL }
};
|