summaryrefslogtreecommitdiffstats
blob: 44fe2a8ca764a5075e95a6d5ec76e50a0425773f (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
44
45
46
47
48
49
50
51
52
53
54
55
/*
 * Copyright (c) 2010 Remko Tronçon
 * Licensed under the GNU General Public License v3.
 * See Documentation/Licenses/GPLv3.txt for more information.
 */

#include "SwifTools/Notifier/Notifier.h"

namespace Swift {

const int Notifier::DEFAULT_STATUS_NOTIFICATION_TIMEOUT_SECONDS;
const int Notifier::DEFAULT_MESSAGE_NOTIFICATION_TIMEOUT_SECONDS;

Notifier::Notifier() : enabled(true) {
}

Notifier::~Notifier() {
}

void Notifier::showMessage(Type type, const String& subject, const String& description, const boost::filesystem::path& picture, boost::function<void()> callback) {
	if (enabled) {
		doShowMessage(type, subject, description, picture, callback);
	}
}

String Notifier::typeToString(Type type) {
	switch (type) {
		case ContactAvailable: return "Contact Becomes Available";
		case ContactUnavailable: return "Contact Becomes Unavailable";
		case ContactStatusChange: return "Contact Changes Status";
		case IncomingMessage: return "Incoming Message";
		case SystemMessage: return "System Message";
	}
	assert(false);
	return "";
}

std::vector<Notifier::Type> Notifier::getAllTypes() {
	std::vector<Type> result;
	result.push_back(ContactAvailable);
	result.push_back(ContactUnavailable);
	result.push_back(ContactStatusChange);
	result.push_back(IncomingMessage);
	result.push_back(SystemMessage);
	return result;
}

std::vector<Notifier::Type> Notifier::getDefaultTypes() {
	std::vector<Type> result;
	result.push_back(IncomingMessage);
	result.push_back(SystemMessage);
	return result;
}

}