void Nav2::CleanupNavigate2()
   {
      coretracefunc();
      ModuleIterator i;
      for (i = allModules.begin() ; i != allModules.end() ; ++i)
      {
         joinModule(*i, (*i)->getName(), 10000, 0);
      }
#ifdef __SYMBIAN32__
      int js = m_archGlobalData->m_timerThread->terminateAndJoin();
      if(mainlog){
         mainlog->debug("Join returned a fishy value: %d.", js);
      }  
#endif

      for (i = allModules.begin() ; i != allModules.end() ; ++i)
      {
         deleteModule(*i);
      }
      allModules.clear();

      deleteModule(hub);
      hub = NULL;
      delete mainlog;
      mainlog = NULL;
      initialized=0;
      shutdownstarted = 0;
   }
bool DockContainer::dockModule(ConfigModule *module)
{
    if(module == _module)
        return true;

    if(_module && _module->isChanged())
    {

        int res = KMessageBox::warningYesNoCancel(this, module ? i18n("There are unsaved changes in the active module.\n"
                                                                      "Do you want to apply the changes before running "
                                                                      "the new module or discard the changes?")
                                                               : i18n("There are unsaved changes in the active module.\n"
                                                                      "Do you want to apply the changes before exiting "
                                                                      "the Control Center or discard the changes?"),
                                                  i18n("Unsaved Changes"), KStdGuiItem::apply(), KStdGuiItem::discard());
        if(res == KMessageBox::Yes)
            _module->module()->applyClicked();
        if(res == KMessageBox::Cancel)
            return false;
    }

    raiseWidget(_busyw);
    kapp->processEvents();

    deleteModule();
    if(!module)
        return true;

    ProxyWidget *widget = loadModule(module);

    KCGlobal::repairAccels(topLevelWidget());
    return (widget != 0);
}
/******************************************************************************
* AUTHOR        : Thanigai 
* DATE          : 29-JUL-2005
* NAME          : deleteWordRecognizer
* DESCRIPTION   : To delete the recognizer object which is created 
*				  using "createWordRecognizer" call
* ARGUMENTS     : obj - handle the previously created recognizer object
* RETURNS       : 0 on success other values error
* NOTES         :
* CHANGE HISTROY
* Author            Date                Description of change
******************************************************************************/
int LTKLipiEngineModule::deleteWordRecognizer(LTKWordRecognizer* obj)
{
	LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
		"Entering: LTKLipiEngineModule::deleteWordRecognizer()"<<endl;

	int errorCode;

	//	Call recognition module's deleteWordRecognizer(obj) 
	if(obj)
	{
		deleteModule(obj);		
		errorCode = module_deleteWordRecognizer(obj);
		if(errorCode !=SUCCESS)
		{
			LOG( LTKLogger::LTK_LOGLEVEL_ERR) << 
    			"Error: " << getErrorMessage(errorCode) << 
    			"LTKLipiEngineModule::deleteShapeRecognizer()"<<endl;
            
			LTKReturnError(errorCode);
		}	
		obj = NULL;
	}
	
	LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
		"Exiting: LTKLipiEngineModule::deleteWordRecognizer()"<<endl;
	
	return SUCCESS;

}
Exemple #4
0
INT_PTR CALLBACK DeleteModuleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg) {
	case WM_INITDIALOG:
		SetWindowText(hwnd,Translate("Delete module from Database... Loading"));
		EnableWindow(GetDlgItem(hwnd,IDC_CONTACTS),0);
		EnableWindow(GetDlgItem(hwnd,IDOK),0);
		SetDlgItemText(hwnd,IDC_INFOTEXT, Translate("Delete module from Database"));
		SetDlgItemText(hwnd,CHK_COPY2ALL, Translate("Delete module from all contacts (Includes Setting)"));
		EnableWindow(GetDlgItem(hwnd,CHK_COPY2ALL),0);
		CheckDlgButton(hwnd,CHK_COPY2ALL,1);
		TranslateDialogDefault(hwnd);
		working = 1;
		forkthread(PopulateModuleDropListThreadFunc,0,hwnd);
		return TRUE;

	case WM_COMMAND:
		switch(LOWORD(wParam)) {
		case IDOK:
			{
				char text[128];
				GetDlgItemText(hwnd,IDC_CONTACTS,text,128);
				SetCursor(LoadCursor(NULL,IDC_WAIT));
				for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
					deleteModule(text,hContact,1);

				// do the null
				deleteModule(text,NULL,1);
				SetCursor(LoadCursor(NULL,IDC_ARROW));
				refreshTree(1);
			}
			// fall through
		case IDCANCEL:
			if (working == 1) {
				working = 0;
				EnableWindow(GetDlgItem(hwnd,IDCANCEL),0);
			}
			else DestroyWindow(hwnd);
		}
		break;

	case WM_DESTROY:
		hwnd2Delete = NULL;
		break;
	}
	return 0;
}
void DockContainer::removeModule()
{
    raiseWidget(_basew);
    deleteModule();

    if(_basew)
        emit newModule(_basew->caption(), "", "");
    else
        emit newModule("", "", "");
}
Exemple #6
0
/*!
 * \brief Module::createActions
 *
 * \todo this doesn't really work at the moment, find out what is wrong
 */
void Module::createActions()
{
    m_deleteAct = new QAction("Delete", this);
    m_deleteAct->setShortcuts(QKeySequence::Delete);
    m_deleteAct->setStatusTip("Delete the module and all of its connections");
    connect(m_deleteAct, SIGNAL(triggered()), this, SLOT(deleteModule()));

    m_execAct = new QAction("Execute", this);
    m_execAct->setStatusTip("Execute the module");
    connect(m_execAct, SIGNAL(triggered()), this, SLOT(execModule()));
}
static PyObject *pycompmanager_removeComponent(PyObject *self, PyObject *args)
{
 int a;          
 char * moduleName;
 
 if (! PyArg_ParseTuple( args,"s",&moduleName)) return NULL;
 
 a=deleteModule(moduleName);
 if(a)
 {
  printf(" %s component is removed\n",moduleName);
  return Py_BuildValue("i", a);
 }
 else
 {
  printf(" Failure to remove %s component\n",moduleName);
  return Py_BuildValue("i", a);
 }
 
}
Exemple #8
0
void __cdecl FindSettings(LPVOID param)
{
	FindInfo* fi = (FindInfo*)param;
	HWND hwndParent = GetParent(fi->hwnd);

	ModuleSettingLL ModuleList, SettingList;
	ModSetLinkLinkItem *module, *setting;

	MCONTACT hContact;
	DBVARIANT dbv = { 0 };

	int foundCount = 0,	 replaceCount = 0, deleteCount = 0;

	DWORD numsearch = 0, numreplace = 0;
	int NULLContactDone = 0;

	if (!fi->search || !EnumModules(&ModuleList)) {
		fi_free(fi);
		return;
	}

	_T2A search(fi->search);
	_T2A replace(fi->replace);

    // skip modules and setting names on unicode search or replace
   	if (IsRealUnicode(fi->search) || IsRealUnicode(fi->replace)) {
   		fi->options &= ~(F_SETNAME | F_MODNAME); 
   		fi->options |= F_UNICODE;
   	}

    if (!(fi->options & F_UNICODE) && (fi->options & F_SETVAL)) {
		char val[16];
		numsearch = strtoul(search, NULL, 10);
		_ultoa(numsearch, val, 10);
		if (!mir_strcmp(search, val)) {
			fi->options |= F_NUMSRCH;
			// replace numeric values only entirely
			if (replace && (fi->options & F_ENTIRE)) {
				numreplace = strtoul(replace, NULL, 10);
				_ultoa(numreplace, val, 10);
				if (!replace[0] || !mir_strcmp(replace, val))
					fi->options |= F_NUMREPL;
			}
		}
	}

	SendDlgItemMessage(hwndParent, IDC_SBAR, SB_SETTEXT, 0, (LPARAM)TranslateT("Searching..."));

	hContact = 0;

	while (GetWindowLongPtr(GetDlgItem(hwndParent, IDC_SEARCH), GWLP_USERDATA)) {

		if (!hContact) {
			if (NULLContactDone) 
				break;
			else {
				NULLContactDone = 1;
				hContact = db_find_first();
			}
		}
		else 
			hContact = db_find_next(hContact);

		for (module = ModuleList.first; module; module = module->next) {

			if (IsModuleEmpty(hContact, module->name))
				continue;

			if (fi->options & (F_SETVAL | F_SETNAME)) {

				if (!EnumSettings(hContact, module->name, &SettingList)) {
					fi_free(fi);
					FreeModuleSettingLL(&ModuleList);
					return;
				}

				for (setting = SettingList.first; setting; setting = setting->next) {

					dbv.type = 0;
					if (db_get_s(hContact, module->name, setting->name, &dbv, 0))
						continue;

					// check in settings value				
					if (fi->options & F_SETVAL) {

						TCHAR *value = NULL;

					    switch(dbv.type) {

						case DBVT_BYTE: 
						case DBVT_WORD: 
						case DBVT_DWORD:
							if ((fi->options & F_NUMSRCH) && numsearch == getNumericValue(&dbv)) {
								TCHAR *val = fi->search;
								int flag = F_SETVAL;

								if (fi->options & F_NUMREPL) {
								    if (replace[0]) {
										db_unset(hContact, module->name, setting->name);
										flag |= F_DELETED;
										deleteCount++;
									} 
									else
									if (setNumericValue(hContact, module->name, setting->name, numreplace, dbv.type)) {
										val = fi->replace;
										flag |= F_REPLACED;
										replaceCount++;
									}
								}

								ItemFound(fi->hwnd, hContact, module->name, setting->name, val, flag);
							}
							break;

						case DBVT_WCHAR:
							if (!value) value = mir_u2t(dbv.pwszVal);
						case DBVT_UTF8:
							if (!value) value = mir_utf8decodeT(dbv.pszVal);
						case DBVT_ASCIIZ:
							if (!value) value = mir_a2t(dbv.pszVal);

							if (FindMatchT(value, fi->search, fi->options)) {
								foundCount++;
								ptrT ptr;
								TCHAR *newValue = value;
								int flag = F_SETVAL;

								if (fi->replace) {
									newValue = (fi->options & F_ENTIRE) ? fi->replace : ptr = multiReplaceT(value, fi->search, fi->replace, fi->options & F_CASE);
									// !!!! delete or make empty ?
									if (!newValue[0]) {
										db_unset(hContact, module->name, setting->name);
										flag |= F_DELETED;
										newValue = value;
										deleteCount++;
									} else {
#ifdef _UNICODE
                                        // save as unicode if needed
										if (dbv.type != DBVT_ASCIIZ || IsRealUnicode(newValue))
											db_set_ws(hContact, module->name, setting->name, newValue);
										else												
#endif
											db_set_s(hContact, module->name, setting->name, _T2A(newValue)); 
										flag |= F_REPLACED;
										replaceCount++;
									}
								}

								ItemFound(fi->hwnd, hContact, module->name, setting->name, newValue, flag);
							}
							mir_free(value);
							break;
						} // switch
					}

					// check in setting name
					if ((fi->options & F_SETNAME) && FindMatchA(setting->name, search, fi->options)) {
						foundCount++;
						ptrA ptr;
						char *newSetting = setting->name;
						int flag = F_SETNAME;

						if (replace) {
							newSetting = (fi->options & F_ENTIRE) ? replace : ptr = multiReplaceA(setting->name, search, replace, fi->options & F_CASE);

							if (!newSetting[0]) {
								db_unset(hContact, module->name, setting->name);
								flag |= F_DELETED;
								newSetting = setting->name;
								deleteCount++;
							} else {
								DBVARIANT dbv2;
								// skip if exist
								if (!db_get_s(hContact, module->name, newSetting, &dbv2, 0)) 
									db_free(&dbv2);
								else if (!db_set(hContact, module->name, newSetting, &dbv)) {
									db_unset(hContact, module->name, setting->name);
									flag |= F_REPLACED;
							 		replaceCount++;
								}
							}
						}

						ItemFound(fi->hwnd, hContact, module->name, newSetting, NULL, flag);
					}

					db_free(&dbv);

				} // for(setting)

				FreeModuleSettingLL(&SettingList);
			}

			// check in module name
			if ((fi->options & F_MODNAME) && FindMatchA(module->name, search, fi->options)) {
				foundCount++;
				char *newModule = module->name;
				int flag = F_MODNAME;
				ptrA ptr;

				if (replace) {
					newModule = (fi->options & F_ENTIRE) ? replace : ptr = multiReplaceA(module->name, search, replace, fi->options & F_CASE);
								
					if (!newModule[0]) {
						deleteModule(hContact, module->name, 0);
						replaceTreeItem(hContact, module->name, NULL);
						flag |= F_DELETED;
						newModule = module->name;
						deleteCount++;
					} 
					else if (renameModule(hContact, module->name, newModule)) {
   						replaceTreeItem(hContact, module->name, NULL);
						flag |= F_REPLACED;
						replaceCount++;
					}
				}

				ItemFound(fi->hwnd, hContact, newModule, 0, 0, flag);
			}

		} // for(module)
	}

	TCHAR msg[MSG_SIZE];	
	mir_sntprintf(msg, TranslateT("Finished. Items found: %d / replaced: %d / deleted: %d"), foundCount, replaceCount, deleteCount);
	SendDlgItemMessage(hwndParent, IDC_SBAR, SB_SETTEXT, 0, (LPARAM)msg);

	if (fi->replace) {
		EnableWindow(GetDlgItem(hwndParent, IDC_SEARCH), 1);
		SetDlgItemText(hwndParent, IDOK, TranslateT("&Replace"));
	}
	else {
		SetDlgItemText(hwndParent, IDC_SEARCH, TranslateT("&Search"));
		EnableWindow(GetDlgItem(hwndParent, IDOK), 1);
	}

	fi_free(fi);
	FreeModuleSettingLL(&ModuleList);

	SetWindowLongPtr(GetDlgItem(hwndParent, IDC_SEARCH), GWLP_USERDATA, 0);
	EnableWindow(GetDlgItem(hwndParent, IDCANCEL), 1);
}
DockContainer::~DockContainer()
{
    deleteModule();
}
Exemple #10
0
void moduleListRightClick(HWND hwnd, WPARAM wParam, LPARAM lParam) // hwnd here is to the main window, NOT the treview
{
	TVHITTESTINFO hti;
	hti.pt.x = (short)LOWORD(GetMessagePos());
	hti.pt.y = (short)HIWORD(GetMessagePos());
	ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);

	if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti)) {
		if (hti.flags & TVHT_ONITEM) {
			TVITEM tvi = {0};
			HMENU hMenu, hSubMenu;
			int menuNumber;
			char module[256];
			tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
			tvi.hItem = hti.hItem;
			tvi.pszText = module;
			tvi.cchTextMax = 255;
			TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
			if (tvi.lParam) {
				ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)tvi.lParam;
				MCONTACT hContact = mtis->hContact;
				GetCursorPos(&hti.pt);
				hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXTMENU));
				TranslateMenu(hMenu);
				if (mtis->type == CONTACT && hContact)
					menuNumber = 2;
				else if ((mtis->type == MODULE) && !hContact)
					menuNumber = 1;
				else if (mtis->type == CONTACT && !hContact)
					menuNumber = 3;
				else if (mtis->type == CONTACT_ROOT_ITEM && !hContact)
					menuNumber = 4;
				else if ((mtis->type == MODULE) && hContact)
					menuNumber = 5;
				else return;
				hSubMenu = GetSubMenu(hMenu, menuNumber);

				TranslateMenu(hSubMenu);
				switch (menuNumber) {
				case 1: // null module
				case 5: // contact module
					{
						// check if we r already watching the module
						int i, watching = 0;
						// check if the setting is being watched and if it is then check the menu item
						if (WatchListArray.item)
							for (i = 0; i < WatchListArray.count; i++)
								if (WatchListArray.item[i].module && (hContact == WatchListArray.item[i].hContact)) {
									if (!mir_strcmp(module, WatchListArray.item[i].module) && !WatchListArray.item[i].setting) {
										// yes so uncheck it
										CheckMenuItem(hSubMenu, MENU_WATCH_ITEM, MF_CHECKED | MF_BYCOMMAND);
										watching = 1;
										break;
									}
								}

						switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, NULL)) {
						case MENU_RENAME_MOD:
							TreeView_EditLabel(GetDlgItem(hwnd, IDC_MODULES), tvi.hItem);
							break;

						case MENU_DELETE_MOD:
							if (deleteModule(module, hContact, 0)) {
								TreeView_DeleteItem(((LPNMHDR)lParam)->hwndFrom, hti.hItem);
								mir_free(mtis);
							}
							break;

						case MENU_COPY_MOD:
							copyModuleMenuItem(module, hContact);
							break;

							////////////////////////////////////////////////////////////////////// divider
						case MENU_WATCH_ITEM:
							if (!watching)
								addSettingToWatchList(hContact, module, 0);
							else
								freeWatchListItem(i);
							if (hwnd2watchedVarsWindow)
								PopulateWatchedWindow(GetDlgItem(hwnd2watchedVarsWindow, IDC_VARS));
							break;

						case MENU_EXPORTMODULE:
							exportDB(hContact, module);
							break;

						case MENU_EXPORTDB:
							exportDB(INVALID_CONTACT_ID, module);
							break;
						}
					}
					break;

				case 2: // contact
					switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, NULL)) {
					case MENU_CLONE_CONTACT:
						if (CloneContact(hContact))
							refreshTree(1);
						break;

					case MENU_DELETE_CONTACT:
						if (db_get_b(NULL, "CList", "ConfirmDelete", 1)) {
							char msg[1024];
							mir_snprintf(msg, SIZEOF(msg), Translate("Are you sure you want to delete contact \"%s\"?"), module);
							if (MessageBox(0, msg, Translate("Confirm contact delete"), MB_YESNO | MB_ICONEXCLAMATION) == IDYES) {
								CallService(MS_DB_CONTACT_DELETE, hContact, 0);
								freeTree(((LPNMHDR)lParam)->hwndFrom, hContact);
								TreeView_DeleteItem(((LPNMHDR)lParam)->hwndFrom, tvi.hItem);
							}
						}
						else {
							CallService(MS_DB_CONTACT_DELETE, hContact, 0);
							freeTree(((LPNMHDR)lParam)->hwndFrom, hContact);
							TreeView_DeleteItem(((LPNMHDR)lParam)->hwndFrom, tvi.hItem);
						}
						break;

					////////////////////////////////////////////////////////////////////// divider
					case MENU_EXPORTCONTACT:
						exportDB(hContact, 0);
						break;
					case MENU_IMPORTFROMTEXT:
						ImportSettingsMenuItem(hContact);
						break;
					case MENU_IMPORTFROMFILE:
						ImportSettingsFromFileMenuItem(hContact, "");
						break;

					////////////////////////////////////////////////////////////////////// divider
					case MENU_ADD_MODULE:
						{
							HWND AddModhwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADD_MODULE), hwnd, AddModDlgProc, hContact);
							char msg[1024];
							mir_snprintf(msg, SIZEOF(msg), Translate("Add module to contact \"%s\""), module);
							SetWindowText(AddModhwnd, module);
						}
						break;
					}
					break;

				case 3: // NULL contact
					switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, NULL)) {
					case MENU_ADD_MODULE:
						{
							HWND AddModhwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADD_MODULE), hwnd, AddModDlgProc, hContact);
							char msg[1024];
							mir_snprintf(msg, SIZEOF(msg), Translate("Add module to contact \"%s\""), module);
							SetWindowText(AddModhwnd, module);
						}
						break;
					case MENU_EXPORTCONTACT:
						exportDB(NULL, 0);
						break;
					case MENU_IMPORTFROMTEXT:
						ImportSettingsMenuItem(NULL);
						break;
					case MENU_IMPORTFROMFILE:
						ImportSettingsFromFileMenuItem(NULL, "");
						break;
					}
					break;

				case 4: // Contacts root
					switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, NULL)) {
					case MENU_EXPORTCONTACT:
						exportDB(INVALID_CONTACT_ID, "");
						break;
					case MENU_IMPORTFROMTEXT:
						ImportSettingsMenuItem(NULL);
						break;
					case MENU_IMPORTFROMFILE:
						ImportSettingsFromFileMenuItem(NULL, "");
						break;
					}
					break;
				}
				DestroyMenu(hMenu);
			}
		}
	}
}
int replaceModule(HWND hwnd, HANDLE hContact, const char *module, const char *find, const char *replace, int mode)
{
	ModuleSettingLL msll;
	ModSetLinkLinkItem *setting;
	char *myreplace = NULL;
	char *newModule;
	int count = 0;

	if (mode & RW_FULL)
		newModule = (char*)replace;
	else {
		myreplace = multiReplace(module, find, replace, mode & RW_CASE);
		newModule = myreplace;
	}

	if (newModule[0] == 0) {
		ItemFound(hwnd, hContact, module, NULL, NULL, FW_MODULE | FW_DELETED);
		deleteModule((char*)module, hContact, 1);
		replaceTreeItem(GetDlgItem(hwnd2mainWindow, IDC_MODULES), hContact, module, NULL);
		mir_free(myreplace);
		return 1;
	}

	if (!IsModuleEmpty(hContact, newModule))
		return 0;

	if (EnumSettings(hContact, (char*)module, &msll)) {
		setting = msll.first;

		while (setting) {
			DBVARIANT dbv;

			if (!GetSetting(hContact, module, setting->name, &dbv)) {
				switch (dbv.type) {
				case DBVT_BYTE:
					db_set_b(hContact, newModule, setting->name, dbv.bVal);
					break;
				case DBVT_WORD:
					db_set_w(hContact, newModule, setting->name, dbv.wVal);
					break;
				case DBVT_DWORD:
					db_set_dw(hContact, newModule, setting->name, dbv.dVal);
					break;
				case DBVT_ASCIIZ:
					db_set_s(hContact, newModule, setting->name, dbv.pszVal);
					break;
				case DBVT_UTF8:
					db_set_utf(hContact, newModule, setting->name, dbv.pszVal);
					break;
				case DBVT_BLOB:
					db_set_blob(hContact, newModule, setting->name, dbv.pbVal, dbv.cpbVal);
					break;
				}

				db_free(&dbv);
				db_unset(hContact, module, setting->name);
			}

			setting = setting->next;
		}
		FreeModuleSettingLL(&msll);

		replaceTreeItem(GetDlgItem(hwnd2mainWindow, IDC_MODULES), hContact, module, newModule);

		ItemFound(hwnd, hContact, newModule, NULL, NULL, FW_MODULE | FW_REPLACED);
		count++;
	}

	mir_free(myreplace);
	return count;
}
void importSettings(HANDLE hContact, char *importstring )
{
	char module[256] = "", setting[256] = "", *end;
	int i=0, value, type;
	importstring = strtok(importstring, "\n");

	SetCursor(LoadCursor(NULL,IDC_WAIT));

	while (importstring != NULL)
	{
		i=0;
		rtrim(importstring);
		if (importstring[i] == '\0')
		{
			importstring = strtok(NULL, "\n");
			continue;
		}
		else if (!strncmp(&importstring[i],"SETTINGS:",strlen("SETTINGS:")))
		{
			importstring = strtok(NULL, "\n");
			continue;
		}
		else if (!strncmp(&importstring[i],"CONTACT:", strlen("CONTACT:")))
		{
			int len, add = 1;
			hContact = INVALID_HANDLE_VALUE;

			i = i + (int)strlen("CONTACT:");
			len = (int)strlen(&importstring[i]);

			if (len > 10)
			{
				char uid[256]="",szUID[256]="",szProto[512]="";
				char *p1,*p2;

				p1 = strrchr(&importstring[i], '>*{');
				p2 = strrchr(&importstring[i], '}*');

				if (p1 && p2 && p1+3 < p2 && p2-p1 < SIZEOF(szUID))
				{
					strncpy(szUID, p1+1, p2-p1-2);

					p1 = strrchr(&importstring[i], ')*<');
					p2 = strrchr(&importstring[i], '>*{');

					if (p1 && p2 && p1+3 < p2 && p2-p1 < SIZEOF(uid))
					{
						strncpy(uid, p1+1, p2-p1-3);

						p1 = strrchr(&importstring[i], ' *(');
						p2 = strrchr(&importstring[i], ')*<');

						if (p1 && p2 && p1+3 < p2 && p2-p1 < SIZEOF(szProto))
						{
							char *protouid;
							strncpy(szProto, p1+1, p2-p1-3);

							protouid = (char*)CallProtoService(szProto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0);
							if ((int)protouid!=CALLSERVICE_NOTFOUND)
							{
								if (!mir_strcmp(protouid, uid))
        							hContact = CheckNewContact(szProto, uid, szUID);
        					}
	        				else
        						hContact = CheckNewContact(szProto, uid, szUID);
						}
					}
				}
			}

 			if (hContact == INVALID_HANDLE_VALUE)
 			{
				HANDLE temp = (HANDLE)CallService(MS_DB_CONTACT_ADD,0,0);
				if (temp)
					hContact = temp;
			}
		}
		else if (importstring[i] == '[' && !strchr(&importstring[i+1],'=') )// get the module
		{
			if (end = strpbrk(&importstring[i+1], "]")) {
				if ((end+1) != '\0') *end = '\0';
				strcpy(module, &importstring[i+1]);
			}
		}
		else if (importstring[i] == '-' && importstring[i+1] == '[' &&
			!strchr(&importstring[i+2],'='))// get the module
		{
			if (end = strpbrk(&importstring[i+2], "]")) {
				if ((end+1) != '\0') *end = '\0';
				strcpy(module, &importstring[i+2]);
				deleteModule(module, hContact, 1);
			}
		}
		else if (strstr(&importstring[i], "=") && module[0]) // get the setting
		{
			if (end = strpbrk(&importstring[i+1], "=")) {
				if ((end+1) != '\0') *end = '\0';
				strcpy(setting, &importstring[i]);

				// get the type
				type = *(end+1);
				if (lstrcmp(module, "CList") == 0 && lstrcmp(setting, "Group") == 0)
				{
					WCHAR* GroupName = mir_a2u(end+2);
					if (!GroupName)
						continue;
					HANDLE GroupHandle = Clist_GroupExists(GroupName);
					if(GroupHandle == 0) {
						GroupHandle = (HANDLE)CallService(MS_CLIST_GROUPCREATE, 0, (LPARAM)GroupName);

						if(GroupHandle) {
							CallService(MS_CLUI_GROUPADDED, (WPARAM)GroupHandle, 0);
							CallService(MS_CLIST_GROUPSETEXPANDED, (WPARAM)GroupHandle, 1);
						}
					}
					mir_free(GroupName);
				}
				switch (type)
				{
					case 'b':
					case 'B':
						if (sscanf((end+2), "%d", &value) == 1)
							DBWriteContactSettingByte(hContact, module, setting, (BYTE)value);
						break;
					case 'w':
					case 'W':
						if (sscanf((end+2), "%d", &value) == 1)
							DBWriteContactSettingWord(hContact, module, setting, (WORD)value);
						break;
					case 'd':
					case 'D':
						if (sscanf((end+2), "%d", &value) == 1)
							DBWriteContactSettingDword(hContact, module, setting, (DWORD)value);
						break;
					case 's':
					case 'S':
						DBWriteContactSettingString(hContact,module, setting, (end+2));
						break;
					case 'g':
					case 'G':
						{	char *pstr;
							for(pstr=end+2;*pstr;pstr++){
								if(*pstr=='\\'){
									switch(pstr[1]){
									case 'n': *pstr='\n'; break;
									case 't': *pstr='\t'; break;
									case 'r': *pstr='\r'; break;
									default:  *pstr=pstr[1]; break;
									}
									MoveMemory(pstr+1,pstr+2,lstrlenA(pstr+2)+1);
						}	}	}
					case 'u':
					case 'U':
						DBWriteContactSettingStringUtf(hContact,module, setting, (end+2));
						break;
					case 'l':
					case 'L':
						DBDeleteContactSetting(hContact, module, setting);
						break;
					case 'n':
					case 'N':
						WriteBlobFromString(hContact, module, setting, (end+2), (int)strlen((end+2)));
						break;
				}
			}
		}
		importstring = strtok(NULL, "\n");
	}
	SetCursor(LoadCursor(NULL,IDC_ARROW));
}