+static void
+echo_msg(struct Client *source_p, struct Client *target_p,
+ enum message_type msgtype, const char *text)
+{
+ if (MyClient(target_p))
+ {
+ if (!IsCapable(target_p, CLICAP_ECHO_MESSAGE))
+ return;
+
+ sendto_one(target_p, ":%s!%s@%s %s %s :%s",
+ target_p->name, target_p->username, target_p->host,
+ cmdname[msgtype],
+ source_p->name,
+ text);
+ return;
+ }
+
+ sendto_one(target_p, ":%s ECHO %c %s :%s",
+ use_id(source_p),
+ msgtype == MESSAGE_TYPE_PRIVMSG ? 'P' : 'N',
+ use_id(target_p),
+ text);
+}
+