/* Sessions Management plugin for Miranda IM Copyright (C) 2007-2008 Danil Mozhar This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "sessions.h" void AddSessionMark(MCONTACT hContact, int mode, char bit) { DBVARIANT dbv; unsigned int i; char temp_1[1]={'\0'},temp_2[1]={'\0'}; char szDst[256]={'\0'}; char* pszBuffer=NULL; if (mode == 0) { if (!db_get_s(hContact, MODNAME, "LastSessionsMarks", &dbv) && dbv.pszVal) { temp_1[0]=dbv.pszVal[0]; for (i=0; i < ses_limit; i++) { temp_2[0]=dbv.pszVal[i+1]; dbv.pszVal[i+1]=temp_1[0]; temp_1[0]=temp_2[0]; } for (i=ses_limit; i < 10; i++) dbv.pszVal[i]='0'; dbv.pszVal[0]=bit; db_set_s(hContact, MODNAME, "LastSessionsMarks", dbv.pszVal); db_free(&dbv); } else if (bit == '1') db_set_s(hContact, MODNAME, "LastSessionsMarks", "10000000000"); } else if (mode == 1) { if (!db_get_s(hContact, MODNAME, "UserSessionsMarks", &dbv) && dbv.pszVal) { if (strlen(dbv.pszVal)