Author: Kev <klmitch@mit.edu>
[ircu2.10.12-pk.git] / ircd / send.c
index 5bdd1048c58e010a078fbf4a9a104478489e76a4..013c88c43ac9de91ae459190a258e5c6b0d89de4 100644 (file)
@@ -215,11 +215,15 @@ void vsendcmdto_one(struct Client *to, const char *cmd, const char *tok,
   vd.vd_format = pattern; /* set up the struct VarData for %v */
   vd.vd_args = vl;
 
-  if (MyUser(to)) /* :nick!user@host form; use cmd */
-    ircd_snprintf(to, sndbuf, sizeof(sndbuf) - 2, ":%s!%s@%s %s %v",
-                 from->name, from->user->username, from->user->host,
-                 cmd, &vd);
-  else /* numeric form; use tok */
+  if (MyUser(to)) { /* :nick!user@host form; use cmd */
+    if (IsServer(from) || IsMe(from))
+      ircd_snprintf(to, sndbuf, sizeof(sndbuf) - 2, ":%s %s %v",
+                   from->name, cmd, &vd);
+    else
+      ircd_snprintf(to, sndbuf, sizeof(sndbuf) - 2, ":%s!%s@%s %s %v",
+                   from->name, from->user->username, from->user->host,
+                   cmd, &vd);
+  } else /* numeric form; use tok */
     ircd_snprintf(to, sndbuf, sizeof(sndbuf) - 2, "%C %s %v", from, tok, &vd);
 
   send_buffer(to, sndbuf);