summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_thread.h
blob: 1a27ca700534db96d834e34f1a3f46879401347a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef _TOX_THREAD_H_
#define _TOX_THREAD_H_

class CToxThread
{
private:
	Tox *tox;
	ToxAV *toxAV;

public:
	CToxThread(Tox_Options *options, TOX_ERR_NEW *error = NULL)
		: tox(NULL), toxAV(NULL)
	{
		tox = tox_new(options, error);
	}

	~CToxThread()
	{
		if (toxAV)
		{
			toxav_kill(toxAV);
			toxAV = NULL;
		}

		if (tox)
		{
			tox_kill(tox);
			tox = NULL;
		}
	}

	Tox* Tox()
	{
		return tox;
	}

	ToxAV* ToxAV()
	{
		return toxAV;
	}
};

#endif //_TOX_THREAD_H_