Anope IRC Services
Anope Support => 2.0.x/1.9.x Support => Topic started by: debhian on July 21, 2010, 11:59:32 PM
-
Hi,
I made an unrealircd module wich send PRIVMSG messages to some users.
It works.
But anope have a problem with the messages. When i send for exemple :
:debhian2!user@HOST PRIVMSG #welcome :test
Anope receives the message within m_privmsg (messages.c:105)
The problem is const char *source wich is filled with "debhian2!user@HOST".
The function u = finduser(source); returns NULL because isn't a valid nick, and an error is sent to the staff chan.
[00:44:01] <Global> test: user record for debhian2!user@HOST not found
Why anope receives badly the messages ? I don't think they are malformed !
Exept the anope error log, every messages are accepted by server and client both.
Thanks
Part of messages.c
int m_privmsg(const char *source, const std::string &receiver, const char *msg)
{
char *target;
time_t starttime, stoptime; /* When processing started and finished */
BotInfo *bi;
ChannelInfo *ci;
User *u;
if (!source || !*source || receiver.empty() || !msg) {
return MOD_CONT;
}
u = finduser(source);
if (!u) {
Alog() << msg << ": user record for " << source << " not found";
-
I suggest you check the IRCd Servert-to-Server Protocol documentation..
UnrealIRCd channel PRIVMSGs look like this:
:Viper PRIVMSG #opers :Channel message goes here...
or like this when tokens are being used..
:Viper ! #opers :Channel message goes here...
So anope moans about receiving it badly because you send it badly. :)
Client-to-Server protocols are not the same as Server-to-Server protocols.. unreal doesn't have to do anything with your message other then pass it along, so there s not much "accepting" that can go wrong.. chances are the client accepts it because it is in a valid server-to-client format so it only goes wrong once it gets to a server that does care about server-to-server standards.. ::)
-
I understand what are you saying, and the RFC goes to the same way:
The extended prefix (["!" user "@" host ]) MUST NOT be used in server
to server communications and is only intended for server to client
messages in order to provide clients with more useful information
about who a message is from without the need for additional queries.
But my module send messages to a client, it's a server->client message. If i send only the nickname without username@host, the client lose informations because he receive only the nickname.
Perhaps anope should not reveive my messages ? Perhaps it's unrealircd wich have a misunderstanding with sendto_one C function ?
-
From what I see in your original post, this is a message to a channel, so hardly one-on-one... every client in the channel will receive that message, and if there s a services client in it, anope will too.
And from a quick look at the unreal code sendto_one() wants a nick, not a nick + host..
Anyways, why on earth would you think that the nick!username@host would be send with every message???
That would be a major overhead... hell, when using tokens unreal even replaces "PRIVMSG" to save on bandwidth.. if a client wants to know the host of a user, that client has to send such a request to the server.
-
It's a major overhead but it's exactly what i receive from unrealIRCD (and others).
And it's a server to client message, i'm sure, if there is 5 clients in the chan, i send 5 PRIVMSG messages to the 5 clients.
So maybe it's an unrealircd problem, or i don't use the correct function, but theoretically my raws are good !
-
My mistake.. I was getting s2c and s2s mixed up again...
I don't think it s an unrealircd problem... I think it s how you use the functions...
sendto_one(aClient target, ":%s PRIVMSG %s :%s", sender_nick, channel, text);
So I guess you ll have to check what you are using as target...
-
Resolved !
The module needs to ignore linked servers (like anope) to work, because it's a LOCAL modification of PRIVMSGs and anope don't need to know the modifications.
My bad, sorry !