X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/c88cdb00957d1bafae4587343b5ab7df14b75f8b..de0ae50d20ee023969d0251493f7cfa41b023ac2:/modules/core/m_nick.c diff --git a/modules/core/m_nick.c b/modules/core/m_nick.c index 6fb0dba..02c2787 100644 --- a/modules/core/m_nick.c +++ b/modules/core/m_nick.c @@ -156,7 +156,7 @@ mr_nick(struct Client *client_p, struct Client *source_p, int parc, const char * return 0; } - if(hash_find_nd(nick)) + if(irc_dictionary_find(nd_dict, nick)) { sendto_one(source_p, form_str(ERR_UNAVAILRESOURCE), me.name, EmptyString(source_p->name) ? "*" : source_p->name, nick); @@ -217,7 +217,7 @@ m_nick(struct Client *client_p, struct Client *source_p, int parc, const char *p return 0; } - if(hash_find_nd(nick)) + if(irc_dictionary_find(nd_dict, nick)) { sendto_one(source_p, form_str(ERR_UNAVAILRESOURCE), me.name, EmptyString(source_p->name) ? "*" : source_p->name, nick); @@ -731,17 +731,18 @@ static void set_initial_nick(struct Client *client_p, struct Client *source_p, char *nick) { char buf[USERLEN + 1]; + char note[NICKLEN + 10]; /* This had to be copied here to avoid problems.. */ - source_p->tsinfo = CurrentTime; + source_p->tsinfo = rb_current_time(); if(source_p->name[0]) del_from_client_hash(source_p->name, source_p); strcpy(source_p->name, nick); add_to_client_hash(nick, source_p); - /* fd_desc is long enough */ - comm_note(client_p->localClient->fd, "Nick: %s", nick); + rb_snprintf(note, sizeof(note), "Nick: %s", nick); + rb_note(client_p->localClient->F, note); if(source_p->flags & FLAGS_SENTUSER) { @@ -758,8 +759,9 @@ change_local_nick(struct Client *client_p, struct Client *source_p, char *nick, int dosend) { struct Client *target_p; - dlink_node *ptr, *next_ptr; + rb_dlink_node *ptr, *next_ptr; struct Channel *chptr; + char note[NICKLEN + 10]; int samenick; if (dosend) @@ -772,10 +774,10 @@ change_local_nick(struct Client *client_p, struct Client *source_p, nick, chptr->chname); return; } - if((source_p->localClient->last_nick_change + ConfigFileEntry.max_nick_time) < CurrentTime) + if((source_p->localClient->last_nick_change + ConfigFileEntry.max_nick_time) < rb_current_time()) source_p->localClient->number_of_nick_changes = 0; - source_p->localClient->last_nick_change = CurrentTime; + source_p->localClient->last_nick_change = rb_current_time(); source_p->localClient->number_of_nick_changes++; if(ConfigFileEntry.anti_nick_flood && !IsOper(source_p) && @@ -794,10 +796,10 @@ change_local_nick(struct Client *client_p, struct Client *source_p, if(!samenick) { /* force the TS to increase -- jilles */ - if (source_p->tsinfo >= CurrentTime) + if (source_p->tsinfo >= rb_current_time()) source_p->tsinfo++; else - source_p->tsinfo = CurrentTime; + source_p->tsinfo = rb_current_time(); monitor_signoff(source_p); /* we only do bancache for local users -- jilles */ if(source_p->user) @@ -841,16 +843,16 @@ change_local_nick(struct Client *client_p, struct Client *source_p, * to clear a clients own list of accepted clients. So just remove * them from everyone elses list --anfl */ - DLINK_FOREACH_SAFE(ptr, next_ptr, source_p->on_allow_list.head) + RB_DLINK_FOREACH_SAFE(ptr, next_ptr, source_p->on_allow_list.head) { target_p = ptr->data; - dlinkFindDestroy(source_p, &target_p->localClient->allow_list); - dlinkDestroy(ptr, &source_p->on_allow_list); + rb_dlinkFindDestroy(source_p, &target_p->localClient->allow_list); + rb_dlinkDestroy(ptr, &source_p->on_allow_list); } - /* fd_desc is long enough */ - comm_note(client_p->localClient->fd, "Nick: %s", nick); + rb_snprintf(note, sizeof(note), "Nick: %s", nick); + rb_note(client_p->localClient->F, note); return; } @@ -868,7 +870,7 @@ change_remote_nick(struct Client *client_p, struct Client *source_p, /* client changing their nick - dont reset ts if its same */ if(!samenick) { - source_p->tsinfo = newts ? newts : CurrentTime; + source_p->tsinfo = newts ? newts : rb_current_time(); monitor_signoff(source_p); } @@ -890,7 +892,7 @@ change_remote_nick(struct Client *client_p, struct Client *source_p, del_from_client_hash(source_p->name, source_p); /* invalidate nick delay when a remote client uses the nick.. */ - if((nd = hash_find_nd(nick))) + if((nd = irc_dictionary_retrieve(nd_dict, nick))) free_nd_entry(nd); strcpy(source_p->name, nick); @@ -1172,9 +1174,22 @@ register_client(struct Client *client_p, struct Client *server, const char *m; int flag; + if(server == NULL) + { + if((server = find_server(NULL, parv[7])) == NULL) + { + sendto_realops_snomask(SNO_GENERAL, L_ALL, + "Ghost killed: %s on invalid server %s", + nick, parv[7]); + sendto_one(client_p, ":%s KILL %s :%s (Server doesn't exist)", + get_id(&me, client_p), nick, me.name); + return 0; + } + } + source_p = make_client(client_p); user = make_user(source_p); - dlinkAddTail(source_p, &source_p->node, &global_client_list); + rb_dlinkAddTail(source_p, &source_p->node, &global_client_list); source_p->hopcount = atoi(parv[2]); source_p->tsinfo = newts; @@ -1212,7 +1227,7 @@ register_client(struct Client *client_p, struct Client *server, } /* remove any nd entries for this nick */ - if((nd = hash_find_nd(nick))) + if((nd = irc_dictionary_retrieve(nd_dict, nick))) free_nd_entry(nd); add_to_client_hash(nick, source_p); @@ -1227,9 +1242,9 @@ register_client(struct Client *client_p, struct Client *server, if(flag & UMODE_SERVICE) { int hit = 0; - dlink_node *ptr; + rb_dlink_node *ptr; - DLINK_FOREACH(ptr, service_list.head) + RB_DLINK_FOREACH(ptr, service_list.head) { if(!irccmp((const char *) ptr->data, server->name)) { @@ -1258,29 +1273,16 @@ register_client(struct Client *client_p, struct Client *server, } if(IsOper(source_p) && !IsService(source_p)) - dlinkAddAlloc(source_p, &oper_list); + rb_dlinkAddAlloc(source_p, &oper_list); SetRemoteClient(source_p); if(++Count.total > Count.max_tot) Count.max_tot = Count.total; - if(server == NULL) - { - if((source_p->servptr = find_server(NULL, server->name)) == NULL) - { - sendto_realops_snomask(SNO_GENERAL, L_ALL, - "Ghost killed: %s on invalid server %s", - source_p->name, server->name); - kill_client(client_p, source_p, "%s (Server doesn't exist)", me.name); - source_p->flags |= FLAGS_KILLED; - return exit_client(NULL, source_p, &me, "Ghosted Client"); - } - } - else - source_p->servptr = server; + source_p->servptr = server; - dlinkAdd(source_p, &source_p->lnode, &source_p->servptr->serv->users); + rb_dlinkAdd(source_p, &source_p->lnode, &source_p->servptr->serv->users); /* fake direction */ if(source_p->servptr->from != source_p->from)