#5 rename member variable

pull/32/head
Geoffrey Merck 4 years ago
parent ab3b1aa55b
commit 605c0aaba8

@ -670,7 +670,7 @@ bool IRCDDBApp::notifyRepeaterNatTraversal(const std::string& repeater)
void IRCDDBApp::msgChannel(IRCMessage *m)
{
if (0==m->getPrefixNick().compare(0, 2, "s-") && m->numParams>=2) // server msg
if (0==m->getPrefixNick().compare(0, 2, "s-") && m->m_numParams>=2) // server msg
doUpdate(m->m_params[1]);
}
@ -826,7 +826,7 @@ static std::string getTableIDString(int tableID, bool spaceBeforeNumber)
void IRCDDBApp::msgQuery(IRCMessage *m)
{
if (0 == m->getPrefixNick().compare(0, 2, "s-") && m->numParams >=2 ) { // server msg
if (0 == m->getPrefixNick().compare(0, 2, "s-") && m->m_numParams >=2 ) { // server msg
std::string msg(m->m_params[1]);
std::vector<std::string> tkz = CUtils::stringTokenizer(msg);

@ -24,14 +24,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
IRCMessage::IRCMessage()
{
numParams = 0;
m_numParams = 0;
m_prefixParsed = false;
}
IRCMessage::IRCMessage(const std::string& toNick, const std::string& msg)
{
m_command.assign("PRIVMSG");
numParams = 2;
m_numParams = 2;
m_params.push_back(toNick);
m_params.push_back(msg);
m_prefixParsed = false;
@ -40,7 +40,7 @@ IRCMessage::IRCMessage(const std::string& toNick, const std::string& msg)
IRCMessage::IRCMessage(const std::string& cmd)
{
m_command = cmd;
numParams = 0;
m_numParams = 0;
m_prefixParsed = false;
}
@ -52,7 +52,7 @@ IRCMessage::~IRCMessage()
void IRCMessage::addParam(const std::string& p)
{
m_params.push_back(p);
numParams = m_params.size();
m_numParams = m_params.size();
}
int IRCMessage::getParamCount()
@ -119,8 +119,8 @@ void IRCMessage::composeMessage(std::string& output)
o.append(m_command);
for (int i=0; i < numParams; i++) {
if (i == (numParams - 1))
for (int i=0; i < m_numParams; i++) {
if (i == (m_numParams - 1))
o.append(std::string(" :") + m_params[i]);
else
o.append(std::string(" ") + m_params[i]);

@ -36,7 +36,7 @@ public:
std::string m_command;
std::vector<std::string> m_params;
int numParams;
int m_numParams;
std::string& getPrefixNick();
std::string& getPrefixName();
std::string& getPrefixHost();

@ -106,12 +106,12 @@ bool IRCProtocol::processQueues(IRCMessageQueue *recvQ, IRCMessageQueue *sendQ)
IRCMessage *m2 = new IRCMessage();
m2->m_command = std::string("PONG");
if (m->m_params.size() > 0) {
m2->numParams = 1;
m2->m_numParams = 1;
m2->m_params.push_back(m->m_params[0]);
}
sendQ -> putMessage(m2);
} else if (0 == m->m_command.compare("JOIN")) {
if (m->numParams>=1 && 0==m->m_params[0].compare(m_channel)) {
if (m->m_numParams>=1 && 0==m->m_params[0].compare(m_channel)) {
if (0==m->getPrefixNick().compare(m_currentNick) && 6==m_state) {
if (m_debugChannel.size())
m_state = 7; // next: join debug_channel
@ -121,7 +121,7 @@ bool IRCProtocol::processQueues(IRCMessageQueue *recvQ, IRCMessageQueue *sendQ)
m_app->userJoin(m->getPrefixNick(), m->getPrefixName(), m->getPrefixHost());
}
if (m->numParams>=1 && 0==m->m_params[0].compare(m_debugChannel)) {
if (m->m_numParams>=1 && 0==m->m_params[0].compare(m_debugChannel)) {
if (0==m->getPrefixNick().compare(m_currentNick) && 8==m_state)
m_state = 10; // next: WHO *
}
@ -131,12 +131,12 @@ bool IRCProtocol::processQueues(IRCMessageQueue *recvQ, IRCMessageQueue *sendQ)
m_state = 11;
}
} else if (0 == m->m_command.compare("PART")) {
if (m->numParams>=1 && 0==m->m_params[0].compare(m_channel)) {
if (m->m_numParams>=1 && 0==m->m_params[0].compare(m_channel)) {
if (m_app != NULL)
m_app->userLeave(m->getPrefixNick());
}
} else if (0 == m->m_command.compare("KICK")) {
if (m->numParams>=2 && 0==m->m_params[0].compare(m_channel)) {
if (m->m_numParams>=2 && 0==m->m_params[0].compare(m_channel)) {
if (0 == m->m_params[1].compare(m_currentNick)) {
// i was kicked!!
delete m;
@ -148,11 +148,11 @@ bool IRCProtocol::processQueues(IRCMessageQueue *recvQ, IRCMessageQueue *sendQ)
if (m_app)
m_app->userLeave(m->getPrefixNick());
} else if (0 == m->m_command.compare("MODE")) {
if (m->numParams>=3 && 0==m->m_params[0].compare(m_channel)) {
if (m->m_numParams>=3 && 0==m->m_params[0].compare(m_channel)) {
if (m_app) {
std::string mode = m->m_params[1];
for (size_t i=1; i<mode.size() && (size_t)m->numParams>=i+2; i++) {
for (size_t i=1; i<mode.size() && (size_t)m->m_numParams>=i+2; i++) {
if ('o' == mode[i]) {
if ('+' == mode[0])
m_app->userChanOp(m->m_params[i+1], true);
@ -163,14 +163,14 @@ bool IRCProtocol::processQueues(IRCMessageQueue *recvQ, IRCMessageQueue *sendQ)
}
}
} else if (0 == m->m_command.compare("PRIVMSG")) {
if (m->numParams==2 && m_app) {
if (m->m_numParams==2 && m_app) {
if (0 == m->m_params[0].compare(m_channel) && m_app)
m_app->msgChannel(m);
else if (0 == m->m_params[0].compare(m_currentNick) && m_app)
m_app->msgQuery(m);
}
} else if (0 == m->m_command.compare("352")) { // WHO list
if (m->numParams>=7 && 0==m->m_params[0].compare(m_currentNick) && 0==m->m_params[1].compare(m_channel)) {
if (m->m_numParams>=7 && 0==m->m_params[0].compare(m_currentNick) && 0==m->m_params[1].compare(m_channel)) {
if (m_app) {
m_app->userJoin(m->m_params[5], m->m_params[2], m->m_params[3]);
m_app->userChanOp(m->m_params[5], 0==m->m_params[6].compare("H@"));
@ -182,7 +182,7 @@ bool IRCProtocol::processQueues(IRCMessageQueue *recvQ, IRCMessageQueue *sendQ)
m_timer = 10; // wait 5 seconds..
}
} else if (0==m->m_command.compare("332") || 0==m->m_command.compare("TOPIC")) { // topic
if (2==m->numParams && m_app && 0==m->m_params[0].compare(m_channel))
if (2==m->m_numParams && m_app && 0==m->m_params[0].compare(m_channel))
m_app->setTopic(m->m_params[1]);
}
@ -194,13 +194,13 @@ bool IRCProtocol::processQueues(IRCMessageQueue *recvQ, IRCMessageQueue *sendQ)
case 1:
m = new IRCMessage();
m->m_command = std::string("PASS");
m->numParams = 1;
m->m_numParams = 1;
m->m_params.push_back(m_password);
sendQ->putMessage(m);
m = new IRCMessage();
m->m_command = std::string("NICK");
m->numParams = 1;
m->m_numParams = 1;
m->m_params.push_back(m_currentNick);
sendQ->putMessage(m);
@ -212,7 +212,7 @@ bool IRCProtocol::processQueues(IRCMessageQueue *recvQ, IRCMessageQueue *sendQ)
if (0 == m_timer) {
m = new IRCMessage();
m->m_command = std::string("USER");
m->numParams = 4;
m->m_numParams = 4;
m->m_params.push_back(m_name);
m->m_params.push_back(std::string("0"));
m->m_params.push_back(std::string("*"));
@ -229,7 +229,7 @@ bool IRCProtocol::processQueues(IRCMessageQueue *recvQ, IRCMessageQueue *sendQ)
chooseNewNick();
m = new IRCMessage();
m->m_command = std::string("NICK");
m->numParams = 1;
m->m_numParams = 1;
m->m_params.push_back(m_currentNick);
sendQ->putMessage(m);
@ -246,7 +246,7 @@ bool IRCProtocol::processQueues(IRCMessageQueue *recvQ, IRCMessageQueue *sendQ)
case 5:
m = new IRCMessage();
m->m_command = std::string("JOIN");
m->numParams = 1;
m->m_numParams = 1;
m->m_params.push_back(m_channel);
sendQ->putMessage(m);
@ -265,7 +265,7 @@ bool IRCProtocol::processQueues(IRCMessageQueue *recvQ, IRCMessageQueue *sendQ)
m = new IRCMessage();
m->m_command = std::string("JOIN");
m->numParams = 1;
m->m_numParams = 1;
m->m_params.push_back(m_debugChannel);
sendQ->putMessage(m);
@ -281,7 +281,7 @@ bool IRCProtocol::processQueues(IRCMessageQueue *recvQ, IRCMessageQueue *sendQ)
case 10:
m = new IRCMessage();
m->m_command = std::string("WHO");
m->numParams = 2;
m->m_numParams = 2;
m->m_params.push_back(m_channel);
m->m_params.push_back(std::string("*"));
sendQ->putMessage(m);
@ -297,7 +297,7 @@ bool IRCProtocol::processQueues(IRCMessageQueue *recvQ, IRCMessageQueue *sendQ)
if (0 == m_timer) {
m = new IRCMessage();
m->m_command = std::string("PING");
m->numParams = 1;
m->m_numParams = 1;
m->m_params.push_back(m_currentNick);
sendQ->putMessage(m);

@ -131,7 +131,7 @@ void IRCReceiver::Entry()
case 2:
if (b == ' ') {
state = 3; // params are next
m->numParams = 1;
m->m_numParams = 1;
m->m_params.push_back(std::string(""));
} else
m->m_command.push_back(b);
@ -139,18 +139,18 @@ void IRCReceiver::Entry()
case 3:
if (b == ' ') {
m->numParams++;
if (m->numParams >= 15)
m->m_numParams++;
if (m->m_numParams >= 15)
state = 5; // ignore the rest
m->m_params.push_back(std::string(""));
} else if (b==':' && m->m_params[m->numParams-1].size()==0)
} else if (b==':' && m->m_params[m->m_numParams-1].size()==0)
state = 4; // rest of line is this param
else
m->m_params[m->numParams-1].push_back(b);
m->m_params[m->m_numParams-1].push_back(b);
break;
case 4:
m->m_params[m->numParams-1].push_back(b);
m->m_params[m->m_numParams-1].push_back(b);
break;
} // switch
}

Loading…
Cancel
Save

Powered by TurnKey Linux.