Convert time-related variables to consistently use "unsigned long".
[srvx.git] / src / proto-common.c
index 729c8fcda38e0d3ef85c085c2cf188855e87a673..618643c831414d54d30223a25acf78123c943a6a 100644 (file)
@@ -57,7 +57,7 @@ extern new_user_func_t *nuf_list;
 extern unsigned int nuf_size, nuf_used;
 extern del_user_func_t *duf_list;
 extern unsigned int duf_size, duf_used;
-extern time_t boot_time;
+extern unsigned long boot_time;
 
 void received_ping(void);
 
@@ -155,7 +155,7 @@ void
 replay_read_line(void)
 {
     struct tm timestamp;
-    time_t new_time;
+    unsigned long new_time;
 
     if (replay_line[0]) return;
   read_line:
@@ -185,7 +185,7 @@ replay_read_line(void)
     timestamp.tm_year = strtoul(replay_line+16, NULL, 10) - 1900;
     timestamp.tm_isdst = 0;
     new_time = mktime(&timestamp);
-    if (new_time == -1) {
+    if (new_time == (unsigned long)-1) {
         log_module(MAIN_LOG, LOG_ERROR, "Unable to parse time struct tm_sec=%d tm_min=%d tm_hour=%d tm_mday=%d tm_mon=%d tm_year=%d", timestamp.tm_sec, timestamp.tm_min, timestamp.tm_hour, timestamp.tm_mday, timestamp.tm_mon, timestamp.tm_year);
     } else {
         now = new_time;
@@ -353,7 +353,8 @@ static CMD_FUNC(cmd_stats)
         return 0;
     switch (argv[1][0]) {
     case 'u': {
-        unsigned int uptime = now - boot_time;
+        unsigned long uptime;
+        uptime = now - boot_time;
         irc_numeric(un, RPL_STATSUPTIME, ":Server Up %d days %d:%02d:%02d",
                     uptime/(24*60*60), (uptime/(60*60))%24, (uptime/60)%60, uptime%60);
         irc_numeric(un, RPL_MAXCONNECTIONS, ":Highest connection count: %d (%d clients)",
@@ -431,7 +432,7 @@ privmsg_chan_helper(struct chanNode *cn, void *data)
 {
     struct privmsg_desc *pd = data;
     struct modeNode *mn;
-    struct chanmsg_func *cf = &chanmsg_funcs[(unsigned char)pd->text[0]];
+    struct chanmsg_func *cf;
     int x;
 
     /* Don't complain if it can't find the modeNode because the channel might
@@ -440,8 +441,9 @@ privmsg_chan_helper(struct chanNode *cn, void *data)
         mn->idle_since = now;
 
     /* Never send a NOTICE to a channel to one of the services */
-    if (!pd->is_notice && cf->func
-        && ((cn->modes & MODE_REGISTERED) || GetUserMode(cn, cf->service)))
+    cf = &chanmsg_funcs[(unsigned char)pd->text[0]];
+    if (!pd->is_notice && cf->func && GetUserMode(cn, cf->service) && !IsDeaf(cf->service))
+        cf->func(pd->user, cn, pd->text+1, cf->service);
 
     /* This catches *all* text sent to the channel that the services server sees */
     for (x = 0; x < ALLCHANMSG_FUNCS_MAX; x++) {