summaryrefslogtreecommitdiff
path: root/plugins/!NotAdopted/sametime/clist_util.cpp
blob: 013f38d14494012f509037bace93165ebc9fd305 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "clist_util.h"

int GroupNameExists(const char *name, int skipGroup)
{
	char idstr[33];
	DBVARIANT dbv;
	int i;

	for (i = 0;; i++) {
		if (i == skipGroup)
			continue;
		itoa(i, idstr, 10);
		if (DBGetContactSettingStringUtf(NULL, "CListGroups", idstr, &dbv))
			break;
		if (strcmp(dbv.pszVal + 1, name) == 0) {
			DBFreeVariant(&dbv);
			return i + 1;
		}
		DBFreeVariant(&dbv);
	}
	return 0;
}