Is it possible to add a switch into SendMessage to allow a DLL to send commands to mIRC as if it was run from the same script that was calling it? This would greatly simplify the passing of data to dlls and back to mirc
Example:
This is currently how you have to pass all (most) TEXT event parameters into a dll:
on *:TEXT:*:#:/dll mydll.dll process_text $&
$event $ulevel $target # $nick $fulladdress $&
$wildsite $maddress $scriptdir $scriptline $script $rawmsg
/* mydll.cpp:
MIRCDLLFUNCTION(process_text) {
// split data god knows how many times
// to read out parameters
char *parsed_data = parse_arguments(data);
char *nick = parsed_data[4];
char *rawmsg = parsed_data[11];
// Build message
sprintf(data, "/echo -at <%s> %s", nick, rawmsg);
SendToMirc(data);
// continue processing other things...
strcpy(data, "some_return_status_code");
return 3;
}
*/
* Keep in mind that for simplicity I didn't bother using half of the parameters that I passed in-- the code would have been far more ugly if I did; not to mention, I didn't even include the (probably hideous) code to parse those parameters out of the single string.
This is how it should be:
on *:TEXT:*:#:dll mydll.dll process_text
/* mydll.cpp:
MIRCDLLFUNCTION(process_text) {
SendToMirc("//echo -at < $+ $nick $+ > $rawmsg");
// continue processing other stuff...
strcpy(data, "some_return_status_code");
return 3;
}
*/
The second looks way easier to me, also far less error prone.
The ability to parse as if it were in the event could be added as a flag to the existing cMethod parameter as 8 or something.
I do see a difficulty in mIRC verifying which event the sendmessage is calling from, or if it's even coming from an event at all. Perhaps someone has an idea on how to solve that; I think it would be worth looking into.