예제 #1
0
// Stop a module by name
bool ICQMain::stopModule(const char *name)
{
	int i = getModuleIndex(name);
	if (i < 0) {
		ICQ_LOG("module %s not found\n", name);
		return false;
	}

	Module *m = getModule(i);
	if (!m)
		return false;

	// Stop all work first
	destroyThreads();

	// Remove it from module list
	for (int e = 0; e < NUM_EVENTS; e++)
		moduleList[e].remove(m);

	// Walk through all sessions to remove it
	if (m->hasSessionEvent)
		sessionHash->walk(sessionWalker, m);

	// Remove and delete this module from system
	removeModule(i);

	// Recover previous work
	startThreads();
	return true;
}
예제 #2
0
Module *ICQMain::getModule(const char *name)
{
	int i = getModuleIndex(name);
	if (i < 0)
		return NULL;

	return getModule(i);
}
예제 #3
0
Module getModule(str name) {
	int index = getModuleIndex(name);
	Module m = moduleIndex[index];
	while(m) {
		//if (strcmp(name, m->name) == 0) {
		if (name == m->name) {
			return m;
		}
		m = m->link;
	}
	return NULL;
}
예제 #4
0
static void clrModuleIndex(Module cur){
	int index = getModuleIndex(cur->name);
	Module prev = NULL;
	Module m = moduleIndex[index];
	while(m) {
		if (m == cur) {
			if (!prev) {
				moduleIndex[index] = m->link;
			} else {
				prev->link = m->link;
			}
			return;
		}
		prev = m;
		m = m->link;
	}
}
예제 #5
0
static void addModuleToIndex(Module cur){
	int index = getModuleIndex(cur->name);
	cur->link = moduleIndex[index];
	moduleIndex[index] = cur;
}