]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - modules/m_services.c
Move RPL_WHOISLOGGEDIN to sendto_one_numeric().
[irc/rqf/shadowircd.git] / modules / m_services.c
index f124fc45f5e86232bf710ff55e39b70b5d93d393..42ea29dc7056876b2ff067220be250f0af1c2663 100644 (file)
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $Id: m_services.c 1907 2006-08-29 19:18:15Z jilles $
  */
 
 #include "stdinc.h"
 
-#include "tools.h"
 #include "send.h"
 #include "channel.h"
 #include "client.h"
@@ -39,7 +37,6 @@
 #include "config.h"
 #include "ircd.h"
 #include "numeric.h"
-#include "memory.h"
 #include "s_conf.h"
 #include "s_newconf.h"
 #include "s_serv.h"
@@ -47,7 +44,6 @@
 #include "msg.h"
 #include "parse.h"
 #include "modules.h"
-#include "sprintf_irc.h"
 #include "whowas.h"
 #include "monitor.h"
 
@@ -108,7 +104,7 @@ me_su(struct Client *client_p, struct Client *source_p,
        if(EmptyString(parv[2]))
                target_p->user->suser[0] = '\0';
        else
-               strlcpy(target_p->user->suser, parv[2], sizeof(target_p->user->suser));
+               rb_strlcpy(target_p->user->suser, parv[2], sizeof(target_p->user->suser));
 
        invalidate_bancache_user(target_p);
 
@@ -122,7 +118,7 @@ me_login(struct Client *client_p, struct Client *source_p,
        if(!IsPerson(source_p))
                return 0;
 
-       strlcpy(source_p->user->suser, parv[1], sizeof(source_p->user->suser));
+       rb_strlcpy(source_p->user->suser, parv[1], sizeof(source_p->user->suser));
        return 0;
 }
 
@@ -154,6 +150,7 @@ me_rsfnc(struct Client *client_p, struct Client *source_p,
        struct Client *target_p;
        struct Client *exist_p;
        time_t newts, curts;
+       char note[NICKLEN + 10];
 
        if(!(source_p->flags & FLAGS_SERVICE))
                return 0;
@@ -197,7 +194,7 @@ me_rsfnc(struct Client *client_p, struct Client *source_p,
                        kill_client_serv_butone(NULL, exist_p, "%s (Nickname regained by services)",
                                                me.name);
 
-               snprintf(buf, sizeof(buf), "Killed (%s (Nickname regained by services))",
+               rb_snprintf(buf, sizeof(buf), "Killed (%s (Nickname regained by services))",
                        me.name);
                exit_client(NULL, exist_p, &me, buf);
        }
@@ -205,8 +202,8 @@ me_rsfnc(struct Client *client_p, struct Client *source_p,
        newts = atol(parv[3]);
 
        /* timestamp is older than 15mins, ignore it */
-       if(newts < (CurrentTime - 900))
-               newts = CurrentTime - 900;
+       if(newts < (rb_current_time() - 900))
+               newts = rb_current_time() - 900;
 
        target_p->tsinfo = newts;
 
@@ -226,8 +223,6 @@ me_rsfnc(struct Client *client_p, struct Client *source_p,
        add_history(target_p, 1);
        sendto_server(NULL, NULL, CAP_TS6, NOCAPS, ":%s NICK %s :%ld",
                        use_id(target_p), parv[2], (long) target_p->tsinfo);
-       sendto_server(NULL, NULL, NOCAPS, CAP_TS6, ":%s NICK %s :%ld",
-                       target_p->name, parv[2], (long) target_p->tsinfo);
 
        del_from_client_hash(target_p->name, target_p);
        strcpy(target_p->name, parv[2]);
@@ -237,13 +232,13 @@ me_rsfnc(struct Client *client_p, struct Client *source_p,
 
        del_all_accepts(target_p);
 
-       comm_note(target_p->localClient->fd, "Nick: %s", target_p->name);
+       rb_snprintf(note, NICKLEN + 10, "Nick: %s", target_p->name);
+       rb_note(target_p->localClient->F, note);
        return 0;
 }
 
 /*
 ** me_nickdelay
-**      parv[0] = sender prefix
 **      parv[1] = duration in seconds (0 to remove)
 **      parv[2] = nick
 */
@@ -259,7 +254,7 @@ me_nickdelay(struct Client *client_p, struct Client *source_p, int parc, const c
        duration = atoi(parv[1]);
        if (duration <= 0)
        {
-               nd = hash_find_nd(parv[2]);
+               nd = irc_dictionary_retrieve(nd_dict, parv[2]);
                if (nd != NULL)
                        free_nd_entry(nd);
        }
@@ -268,9 +263,9 @@ me_nickdelay(struct Client *client_p, struct Client *source_p, int parc, const c
                if (duration > 86400)
                        duration = 86400;
                add_nd_entry(parv[2]);
-               nd = hash_find_nd(parv[2]);
+               nd = irc_dictionary_retrieve(nd_dict, parv[2]);
                if (nd != NULL)
-                       nd->expire = CurrentTime + duration;
+                       nd->expire = rb_current_time() + duration;
        }
 
        return 0;
@@ -279,9 +274,9 @@ me_nickdelay(struct Client *client_p, struct Client *source_p, int parc, const c
 static void
 h_svc_server_introduced(hook_data_client *hdata)
 {
-       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, hdata->target->name))
                {
@@ -306,9 +301,8 @@ h_svc_whois(hook_data_client *data)
                if(*p == '\0')
                        p = data->target->user->suser;
 
-               sendto_one(data->client, form_str(RPL_WHOISLOGGEDIN),
-                               get_id(&me, data->client),
-                               get_id(data->client, data->client),
+               sendto_one_numeric(data->client, RPL_WHOISLOGGEDIN,
+                               form_str(RPL_WHOISLOGGEDIN),
                                data->target->name, p);
        }
 }
@@ -317,11 +311,11 @@ static void
 h_svc_stats(hook_data_int *data)
 {
        char statchar = (char) data->arg2;
-       dlink_node *ptr;
+       rb_dlink_node *ptr;
 
        if (statchar == 'U' && IsOper(data->client))
        {
-               DLINK_FOREACH(ptr, service_list.head)
+               RB_DLINK_FOREACH(ptr, service_list.head)
                {
                        sendto_one_numeric(data->client, RPL_STATSULINE,
                                                form_str(RPL_STATSULINE),