Fix several issues in modpython.

1. In several cases CString wasn't handled properly.
2. Some container-like object didn't return from functions properly.
3. Buffer.h was missing
This commit is contained in:
Alexey Sokolov
2012-01-02 14:39:17 +07:00
parent 13bfec0809
commit f374874b1a
3 changed files with 32 additions and 3 deletions

View File

@@ -28,6 +28,7 @@
#include "../include/znc/FileUtils.h"
#include "../include/znc/ZNCDebug.h"
#include "../include/znc/ExecSock.h"
#include "../include/znc/Buffer.h"
#include "modpython/module.h"
#include "modpython/retstring.h"
@@ -67,6 +68,10 @@ namespace std {
}
%}
%template(VIRCNetworks) std::vector<CIRCNetwork*>;
%template(VChannels) std::vector<CChan*>;
%template(MNicks) std::map<CString, CNick>;
%typemap(in) CString& {
String* p;
int res = SWIG_IsOK(SWIG_ConvertPtr($input, (void**)&p, SWIG_TypeQuery("String*"), 0));
@@ -111,6 +116,7 @@ namespace std {
%include "../include/znc/Server.h"
%include "../include/znc/ZNCDebug.h"
%include "../include/znc/ExecSock.h"
%include "../include/znc/Buffer.h"
%include "modpython/module.h"
@@ -167,6 +173,9 @@ public:
CString __repr__() {
return "<CUser " + $self->GetUserName() + ">";
}
std::vector<CIRCNetwork*> GetNetworks_() {
return $self->GetNetworks();
}
};
%extend CIRCNetwork {
@@ -176,6 +185,9 @@ public:
CString __repr__() {
return "<CIRCNetwork " + $self->GetName() + ">";
}
std::vector<CChan*> GetChans_() {
return $self->GetChans();
}
}
%extend CChan {
@@ -185,6 +197,9 @@ public:
CString __repr__() {
return "<CChan " + $self->GetName() + ">";
}
std::map<CString, CNick> GetNicks_() {
return $self->GetNicks();
}
};
%extend CNick {