0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-29 04:08:54 +02:00

alias: cleanups

This commit is contained in:
William Pitcock 2016-07-31 03:24:12 -05:00
parent d0a59d58a0
commit 92415a5371

View file

@ -111,7 +111,7 @@ m_alias(struct MsgBuf *msgbuf, struct Client *client_p, struct Client *source_p,
{ {
struct Client *target_p; struct Client *target_p;
std::shared_ptr<alias_entry> aptr = alias_dict[msgbuf->cmd]; std::shared_ptr<alias_entry> aptr = alias_dict[msgbuf->cmd];
char *p, *str; char *str;
if(aptr == NULL) if(aptr == NULL)
{ {
@ -126,11 +126,11 @@ m_alias(struct MsgBuf *msgbuf, struct Client *client_p, struct Client *source_p,
if(!IsFloodDone(client_p) && client_p->localClient->receiveM > 20) if(!IsFloodDone(client_p) && client_p->localClient->receiveM > 20)
flood_endgrace(client_p); flood_endgrace(client_p);
p = strchr(aptr->target.c_str(), '@'); auto pos = aptr->target.find('@');
if(p != NULL) if(pos != std::string::npos)
{ {
/* user@server */ /* user@server */
target_p = find_server(NULL, p + 1); target_p = find_server(NULL, aptr->target.substr(pos + 1).c_str());
if(target_p != NULL && IsMe(target_p)) if(target_p != NULL && IsMe(target_p))
target_p = NULL; target_p = NULL;
} }
@ -157,6 +157,6 @@ m_alias(struct MsgBuf *msgbuf, struct Client *client_p, struct Client *source_p,
sendto_one(target_p, ":%s PRIVMSG %s :%s", sendto_one(target_p, ":%s PRIVMSG %s :%s",
get_id(client_p, target_p), get_id(client_p, target_p),
p != NULL ? aptr->target.c_str() : get_id(target_p, target_p), pos != std::string::npos ? aptr->target.c_str() : get_id(target_p, target_p),
str); str);
} }