Boa noite, estou tentando fazer meu primeiro plugin de velocidade, mas ainda não sei se ta funcionando, gostaria que alguem desse uma olhada, segue abaixo.
Att.
Anderson Junior
Código [Seleccionar]
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include "../utils.cpp"
using namespace std;
// use this line to compile
// g++ -I. -fPIC -shared -g -o rjnet.com.br.so rjnet.com.br.cpp
// Regex
// http.*\.rjnet\.com\.br.*(\.swf|\.jpg|\.bmp|\.txt|\.jpeg)
string get_filename(string url) {
vector<string> resultado;
string retorna = "";
stringexplode(url, "/", &resultado);
retorna = resultado.at(resultado.size()-2) + "-"+resultado.at(resultado.size()-1);
return retorna;
}
extern "C" resposta getmatch(const string url) {
resposta r;
if ( (url.find("rjnet.com.br") != string::npos)
) {
r.file = get_filename(url);
if (!r.file.empty()) {
r.match = true;
r.domain = "rjnet.com.br";
} else {
r.match = false;
}
}
else
{
r.match = false;
}
return r;
}
Att.
Anderson Junior