// release all allocated structures holding geometric data void geometry_release() { for ALL(shots, i) { DYN_FREE(shots.data[i].points); if (shots.data[i].keypoints) { free(shots.data[i].keypoints); } if (shots.data[i].kd_tree) { kdtree_release(shots.data[i].kd_tree); shots.data[i].kd_tree = NULL; } shots.data[i].keypoints_count = 0; }
int m_chgident(aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; char *s; int legalident = 1; if (MyClient(sptr) && !IsAnOper(sptr)) { sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); return 0; } #ifdef DISABLE_USERMOD if (MyClient(sptr)) { sendto_one(sptr, err_str(ERR_DISABLED), me.name, sptr->name, "CHGIDENT", "This command is disabled on this server"); return 0; } #endif if ((parc < 3) || !*parv[2]) { sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), me.name, sptr->name, "CHGIDENT"); return 0; } if (strlen(parv[2]) > (USERLEN)) { sendnotice(sptr, "*** ChgIdent Error: Requested ident too long -- rejected."); return 0; } /* illegal?! */ for (s = parv[2]; *s; s++) { if ((*s == '~') && (s == parv[2])) continue; if (!isallowed(*s)) { legalident = 0; } } if (legalident == 0) { sendnotice(sptr, "*** /ChgIdent Error: A ident may contain a-z, A-Z, 0-9, '-' & '.' - Please only use them"); return 0; } if ((acptr = find_person(parv[1], NULL))) { DYN_LOCAL(char, did_parts, acptr->user->joined); switch (UHOST_ALLOWED) { case UHALLOW_NEVER: if (MyClient(sptr)) { sendto_one(sptr, err_str(ERR_DISABLED), me.name, sptr->name, "CHGIDENT", "This command is disabled on this server"); DYN_FREE(did_parts); return 0; } break; case UHALLOW_ALWAYS: break; case UHALLOW_NOCHANS: if (IsPerson(acptr) && MyClient(sptr) && acptr->user->joined) { sendnotice(sptr, "*** /ChgIdent can not be used while %s is on a channel", acptr->name); DYN_FREE(did_parts); return 0; } break; case UHALLOW_REJOIN: rejoin_doparts(acptr, did_parts); /* join sent later when the ident has been changed */ break; } if (!IsULine(sptr)) { sendto_snomask(SNO_EYES, "%s changed the virtual ident of %s (%s@%s) to be %s", sptr->name, acptr->name, acptr->user->username, GetHost(acptr), parv[2]); /* Logging ability added by XeRXeS */ ircd_log(LOG_CHGCMDS, "CHGIDENT: %s changed the virtual ident of %s (%s@%s) to be %s", sptr->name, acptr->name, acptr->user->username, GetHost(acptr), parv[2]); } sendto_serv_butone_token(cptr, sptr->name, MSG_CHGIDENT, TOK_CHGIDENT, "%s %s", acptr->name, parv[2]); ircsprintf(acptr->user->username, "%s", parv[2]); if (UHOST_ALLOWED == UHALLOW_REJOIN) rejoin_dojoinandmode(acptr, did_parts); DYN_FREE(did_parts); return 0; }