sockaddr_in client,server;
socklen_t length;
-extern InspSocket* socket_ref[65535];
+extern InspSocket* socket_ref[MAX_DESCRIPTORS];
time_t TIME = time(NULL), OLDTIME = time(NULL);
-SocketEngine* SE = NULL;
-
// This table references users by file descriptor.
// its an array to make it VERY fast, as all lookups are referenced
// by an integer, meaning there is no need for a scan/search operation.
}
+void InspIRCd::BuildISupport()
+{
+ // the neatest way to construct the initial 005 numeric, considering the number of configure constants to go in it...
+ std::stringstream v;
+ v << "WALLCHOPS MODES=13 CHANTYPES=# PREFIX=(ohv)@%+ MAP SAFELIST MAXCHANNELS=" << MAXCHANS << " MAXBANS=60 NICKLEN=" << NICKMAX;
+ v << " CASEMAPPING=rfc1459 STATUSMSG=@+ CHARSET=ascii TOPICLEN=" << MAXTOPIC << " KICKLEN=" << MAXKICK << " MAXTARGETS=20 AWAYLEN=";
+ v << MAXAWAY << " CHANMODES=ohvb,k,l,psmnti NETWORK=" << Config->Network;
+ Config->data005 = v.str();
+ FOREACH_MOD(I_On005Numeric,On005Numeric(Config->data005));
+}
+
bool InspIRCd::UnloadModule(const char* filename)
{
std::string filename_str = filename;
Parser->RemoveCommands(filename);
log(DEFAULT,"Module %s unloaded",filename);
MODCOUNT--;
+ BuildISupport();
return true;
}
}
{
char modfile[MAXBUF];
#ifdef STATIC_LINK
- snprintf(modfile,MAXBUF,"%s",filename);
+ strlcpy(modfile,filename,MAXBUF);
#else
snprintf(modfile,MAXBUF,"%s/%s",Config->ModPath,filename);
#endif
#endif
MODCOUNT++;
FOREACH_MOD(I_OnLoadModule,OnLoadModule(modules[MODCOUNT],filename_str));
+ BuildISupport();
return true;
}
int InspIRCd::Run()
{
bool expire_run = false;
- int activefds[65535];
+ int activefds[MAX_DESCRIPTORS];
int incomingSockfd;
int in_port;
userrec* cu = NULL;
}
/* Once a second, do the background processing */
- if ((TIME != OLDTIME) && ((TIME % 2) == 0))
+ if (TIME != OLDTIME)
DoBackgroundUserStuff(TIME);
/* Call the socket engine to wait on the active
* descriptors in its list... dns, modules, users,
* servers... so its nice and easy, just one call.
*/
- numberactive = SE->Wait(activefds);
-
- if (!numberactive)
+ if (!(numberactive = SE->Wait(activefds)))
continue;
- log(DEBUG,"%d active fds this time around",numberactive);
-
/**
* Now process each of the fd's. For users, we have a fast
* lookup table which can find a user by file descriptor, so