Merge branch '1.7.x'

This commit is contained in:
Alexey Sokolov
2018-06-04 22:30:53 +01:00
12 changed files with 145 additions and 47 deletions
+1 -1
View File
@@ -76,7 +76,7 @@ class CAdminLogMod : public CModule {
Log("[" + GetUser()->GetUserName() + "/" + GetNetwork()->GetName() +
"] disconnected from IRC: " +
GetNetwork()->GetCurrentServer()->GetName() + " [" +
Message.GetParams(1) + "]",
Message.GetParamsColon(1) + "]",
LOG_NOTICE);
}
return CONTINUE;
+5 -2
View File
@@ -32,9 +32,12 @@ class CFloodDetachMod : public CModule {
AddCommand("Secs", t_d("[<limit>]"),
t_d("Show or set number of seconds in the time interval"),
[=](const CString& sLine) { SecsCommand(sLine); });
AddCommand("Lines", t_d("[<limit>]"), t_d("blahblah: description"),
AddCommand("Lines", t_d("[<limit>]"),
t_d("Show or set number of lines in the time interval"),
[=](const CString& sLine) { LinesCommand(sLine); });
AddCommand("Silent", t_d("[yes|no]"), t_d("blahblah: description"),
AddCommand("Silent", "[yes|no]",
t_d("Show or set whether to notify you about detaching and "
"attaching back"),
[=](const CString& sLine) { SilentCommand(sLine); });
}
+25 -30
View File
@@ -73,21 +73,24 @@ namespace std {
};
}
%include "modperl/CString.i"
%template(_stringlist) std::list<CString>;
%typemap(out) std::list<CString> {
std::list<CString>::const_iterator i;
unsigned int j;
int len = $1.size();
SV **svs = new SV*[len];
for (i=$1.begin(), j=0; i!=$1.end(); i++, j++) {
svs[j] = sv_newmortal();
SwigSvFromString(svs[j], *i);
}
AV *myav = av_make(len, svs);
delete[] svs;
$result = newRV_noinc((SV*) myav);
sv_2mortal($result);
argvi++;
%typemap(out) VCString {
EXTEND(sp, $1.size());
for (int i = 0; i < $1.size(); ++i) {
SV* x = newSV(0);
SwigSvFromString(x, $1[i]);
$result = sv_2mortal(x);
argvi++;
}
}
%typemap(out) const VCString& {
EXTEND(sp, $1->size());
for (int i = 0; i < $1->size(); ++i) {
SV* x = newSV(0);
SwigSvFromString(x, (*$1)[i]);
$result = sv_2mortal(x);
argvi++;
}
}
%template(VIRCNetworks) std::vector<CIRCNetwork*>;
@@ -176,26 +179,18 @@ class MCString : public std::map<CString, CString> {};
%}
%extend CModule {
std::list<CString> _GetNVKeys() {
std::list<CString> res;
for (MCString::iterator i = $self->BeginNV(); i != $self->EndNV(); ++i) {
res.push_back(i->first);
}
return res;
}
VCString GetNVKeys() {
VCString result;
for (auto i = $self->BeginNV(); i != $self->EndNV(); ++i) {
result.push_back(i->first);
}
return result;
}
bool ExistsNV(const CString& sName) {
return $self->EndNV() != $self->FindNV(sName);
}
}
%perlcode %{
package ZNC::CModule;
sub GetNVKeys {
my $result = _GetNVKeys(@_);
return @$result;
}
%}
%extend CModules {
void push_back(CModule* p) {
$self->push_back(p);
+3 -1
View File
@@ -7,6 +7,7 @@
Remove unrelated stuff from top of file which is included by default
s/std::string/CString/g
s/std_string/CString/g
Add "%traits_ptypen(CString);"
*/
//
@@ -17,6 +18,7 @@
%feature("naturalvar") CString;
class CString;
%traits_ptypen(CString);
/*@SWIG:/swig/3.0.8/typemaps/CStrings.swg,70,%typemaps_CString@*/
@@ -74,7 +76,7 @@ SWIG_AsVal_CString (PyObject * obj, CString *val)
}
/*@SWIG@*/
/*@SWIG:/swig/3.0.8/typemaps/CStrings.swg,38,%CString_from@*/
%fragment("SWIG_" "From" "_" {CString},"header",fragment="SWIG_FromCharPtrAndSize") {
%fragment("SWIG_" "From" "_" {CString},"header",fragment="SWIG_FromCharPtrAndSize", fragment="StdTraits") {
SWIGINTERNINLINE PyObject *
SWIG_From_CString (const CString& s)
{
+1 -1
View File
@@ -304,7 +304,7 @@ class CRouteRepliesMod : public CModule {
// If there are arguments to a mode change,
// we must not route it.
if (!Message.GetParams(2).empty()) return CONTINUE;
if (!Message.GetParamsColon(2).empty()) return CONTINUE;
// Grab the mode change parameter
CString sMode = Message.GetParam(1);
+1 -1
View File
@@ -144,7 +144,7 @@ class CSChat : public CModule {
EModRet OnUserRawMessage(CMessage& msg) override {
if (!msg.GetCommand().Equals("schat")) return CONTINUE;
const CString sParams = msg.GetParams(0);
const CString sParams = msg.GetParamsColon(0);
if (sParams.empty()) {
PutModule("SChat User Area ...");
OnModCommand("help");