diff --git a/include/modules.h b/include/modules.h index ef6cf59d8..9cc3a53de 100644 --- a/include/modules.h +++ b/include/modules.h @@ -823,6 +823,7 @@ extern char *moddata_client_get(aClient *acptr, char *varname); #define EFUNC_SEND_MD_MEMBER 40 #define EFUNC_SEND_MD_MEMBERSHIP 41 #define EFUNC_CHECK_BANNED 42 +#define EFUNC_INTRODUCE_USER 43 /* Module flags */ #define MODFLAG_NONE 0x0000 diff --git a/src/modules.c b/src/modules.c index f91270cb2..ba6d09448 100644 --- a/src/modules.c +++ b/src/modules.c @@ -115,6 +115,7 @@ void (*spamfilter_build_user_string)(char *buf, char *nick, aClient *acptr); int (*is_silenced)(aClient *sptr, aClient *acptr); void (*send_protoctl_servers)(aClient *sptr, int response); int (*verify_link)(aClient *cptr, aClient *sptr, char *servername, ConfigItem_link **link_out); +void (*introduce_user)(aClient *to, aClient *acptr); void (*send_server_message)(aClient *sptr); void (*send_md_client)(ModDataInfo *mdi, aClient *acptr, ModData *md); void (*send_md_channel)(ModDataInfo *mdi, aChannel *chptr, ModData *md); @@ -166,7 +167,8 @@ static const EfunctionsList efunction_table[MAXEFUNCTIONS] = { /* 40 */ {"send_md_member", (void *)&send_md_member}, /* 41 */ {"send_md_membership", (void *)&send_md_membership}, /* 42 */ {"check_banned", (void *)&check_banned}, -/* 43 */ {NULL, NULL} +/* 43 */ {"introduce_user", (void *)&introduce_user}, +/* 44 */ {NULL, NULL} }; #ifdef UNDERSCORE diff --git a/src/modules/m_server.c b/src/modules/m_server.c index f6fbef281..84ef2fef0 100644 --- a/src/modules/m_server.c +++ b/src/modules/m_server.c @@ -47,6 +47,7 @@ DLLFUNC int m_server_remote(aClient *cptr, aClient *sptr, int parc, char *parv[] int _verify_link(aClient *cptr, aClient *sptr, char *servername, ConfigItem_link **link_out); void _send_protoctl_servers(aClient *sptr, int response); void _send_server_message(aClient *sptr); +void _introduce_user(aClient *to, aClient *acptr); static char buf[BUFSIZE]; @@ -68,6 +69,7 @@ MOD_TEST(m_server) EfunctionAddVoid(modinfo->handle, EFUNC_SEND_PROTOCTL_SERVERS, _send_protoctl_servers); EfunctionAddVoid(modinfo->handle, EFUNC_SEND_SERVER_MESSAGE, _send_server_message); EfunctionAdd(modinfo->handle, EFUNC_VERIFY_LINK, _verify_link); + EfunctionAddVoid(modinfo->handle, EFUNC_INTRODUCE_USER, _introduce_user); return MOD_SUCCESS; } @@ -631,6 +633,36 @@ CMD_FUNC(m_server_remote) return 0; } +void _introduce_user(aClient *to, aClient *acptr) +{ + send_umode(NULL, acptr, 0, SEND_UMODES, buf); + + sendto_one_nickcmd(to, acptr, buf); + + send_moddata_client(to, acptr); + + if (acptr->user->away) + sendto_one(to, ":%s AWAY :%s", CHECKPROTO(to, PROTO_SID) ? ID(acptr) : acptr->name, + acptr->user->away); + + if (acptr->user->swhois) + { + SWhois *s; + for (s = acptr->user->swhois; s; s = s->next) + { + if (CHECKPROTO(to, PROTO_EXTSWHOIS)) + { + sendto_one(to, ":%s SWHOIS %s + %s %d :%s", + me.name, acptr->name, s->setby, s->priority, s->line); + } else + { + sendto_one(to, ":%s SWHOIS %s :%s", + me.name, acptr->name, s->line); + } + } + } +} + int m_server_synch(aClient *cptr, ConfigItem_link *aconf) { char *inpath = get_client_name(cptr, TRUE); @@ -769,33 +801,7 @@ int m_server_synch(aClient *cptr, ConfigItem_link *aconf) continue; if (IsPerson(acptr)) { - send_umode(NULL, acptr, 0, SEND_UMODES, buf); - - sendto_one_nickcmd(cptr, acptr, buf); - - send_moddata_client(cptr, acptr); - - if (acptr->user->away) - sendto_one(cptr, ":%s AWAY :%s", CHECKPROTO(cptr, PROTO_SID) ? ID(acptr) : acptr->name, - acptr->user->away); - - if (acptr->user->swhois) - { - SWhois *s; - for (s = acptr->user->swhois; s; s = s->next) - { - if (CHECKPROTO(cptr, PROTO_EXTSWHOIS)) - { - sendto_one(cptr, ":%s SWHOIS %s + %s %d :%s", - me.name, acptr->name, s->setby, s->priority, s->line); - } else - { - sendto_one(cptr, ":%s SWHOIS %s :%s", - me.name, acptr->name, s->line); - } - } - } - + introduce_user(cptr, acptr); if (!SupportSJOIN(cptr)) send_user_joins(cptr, acptr); }