AuthorMessage
dzadzuks
Ametuar
Posts: 135

Hi,
I dont write this in the bug reports post, because i am not sure this is a bug, i just wanted to know if this must be like this:
basically in this plugin,  i register the command when plugin is being initialized (RegisterCommand), so everything works ok, the onRegisteredCommand is fired with the right parameters as i sent from DC client, but when i send MANY commands (like 3) very fast with the user command, then the whole 3 commands, includig the trigger are in commandParamerers seperated with |.
Example, i register command 'cmd', and add it to user command too then i have this:
Code:
void CALLBACK onRegisteredCommand(long dwCommandId,long userId,void *rights,const char *commandParameters,bool isPM)
{
   //########
   ofstream tests("Plugins\\debugz.txt",fstream::app);
   tests<<commandParameters<<"\n";
   tests.close();
   //########
}

Then i call it like this '!cmd test' from user command menu fast 3 times, and the debugz.txt looks like this:
Code:
test|<mynick> !cmd test|<mynick> !cmd test|
test|<mynick> !cmd test|
test|

So looks like the command parameters are wrong, as it takes the next command within..
Lord_Zero
Ametuar
Posts: 122

As i see it looks ok. You called it 3 times and your function was called 3 times. Your function should not scan what's after command separator |.
dzadzuks
Ametuar
Posts: 135

I see how it works now.. just got a bit confused about the commandParameters, thought it must contine just that 1 command parameters at same time
Lord_Zero
Ametuar
Posts: 122

Data that is after command separator is not parsed yet by hub at the time when your function is called. Trying to access data that's after that separator may result in page faults.
Code:
   commandParameters = pointer to a buffer with command's parameters, terminator = '|'