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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
/*
meanwhileprotocol.cpp - the meanwhile protocol
Copyright (c) 2003-2004 by Sivaram Gottimukkala <[email protected]>
Kopete (c) 2002-2004 by the Kopete developers <[email protected]>
*************************************************************************
* *
* 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 2 of the License, or *
* (at your option) any later version. *
* *
*************************************************************************
*/
#include "meanwhileprotocol.h"
#include "meanwhileaddcontactpage.h"
#include "meanwhileeditaccountwidget.h"
#include "meanwhileaccount.h"
#include <kgenericfactory.h>
#include "kopeteaccountmanager.h"
#include "kopeteglobal.h"
#include "kopeteonlinestatusmanager.h"
#include "mw_common.h"
typedef KGenericFactory<MeanwhileProtocol> MeanwhileProtocolFactory;
K_EXPORT_COMPONENT_FACTORY(kopete_meanwhile,
MeanwhileProtocolFactory("kopete_meanwhile"))
MeanwhileProtocol::MeanwhileProtocol(TQObject* parent, const char *name,
const TQStringList &/*args*/)
: Kopete::Protocol(MeanwhileProtocolFactory::instance(), parent, name),
statusOffline(Kopete::OnlineStatus::Offline, 25, this, 0, TQString(),
i18n("Offline"), i18n("Offline"),
Kopete::OnlineStatusManager::Offline,
Kopete::OnlineStatusManager::DisabledIfOffline),
statusOnline(Kopete::OnlineStatus::Online, 25, this, mwStatus_ACTIVE,
TQString(), i18n("Online"), i18n("Online"),
Kopete::OnlineStatusManager::Online, 0),
statusAway(Kopete::OnlineStatus::Away, 20, this, mwStatus_AWAY,
"meanwhile_away", i18n("Away"), i18n("Away"),
Kopete::OnlineStatusManager::Away,
Kopete::OnlineStatusManager::HasAwayMessage),
statusBusy(Kopete::OnlineStatus::Away, 25, this, mwStatus_BUSY,
"meanwhile_dnd", i18n("Busy"), i18n("Busy"),
Kopete::OnlineStatusManager::Busy,
Kopete::OnlineStatusManager::HasAwayMessage),
statusIdle(Kopete::OnlineStatus::Away, 30, this, mwStatus_AWAY,
"meanwhile_idle", i18n("Idle"), i18n("Idle"),
Kopete::OnlineStatusManager::Idle, 0),
statusAccountOffline(Kopete::OnlineStatus::Offline, 0, this, 0,
TQString(), i18n("Account Offline")),
statusMessage(TQString::tqfromLatin1("statusMessage"),
i18n("Status Message"), TQString(), false, true),
awayMessage(Kopete::Global::Properties::self()->awayMessage())
{
HERE;
addAddressBookField("messaging/meanwhile", Kopete::Plugin::MakeIndexField);
}
MeanwhileProtocol::~MeanwhileProtocol()
{
}
AddContactPage * MeanwhileProtocol::createAddContactWidget(TQWidget *parent,
Kopete::Account *account )
{
return new MeanwhileAddContactPage(parent, account);
}
KopeteEditAccountWidget * MeanwhileProtocol::createEditAccountWidget(
Kopete::Account *account, TQWidget *parent )
{
return new MeanwhileEditAccountWidget(parent, account, this);
}
Kopete::Account *MeanwhileProtocol::createNewAccount(const TQString &accountId)
{
return new MeanwhileAccount(this, accountId, accountId.ascii());
}
Kopete::Contact *MeanwhileProtocol::deserializeContact(
Kopete::MetaContact *metaContact,
const TQMap<TQString,
TQString> &serializedData,
const TQMap<TQString, TQString> & /* addressBookData */ )
{
TQString contactId = serializedData[ "contactId" ];
TQString accountId = serializedData[ "accountId" ];
MeanwhileAccount *theAccount =
static_cast<MeanwhileAccount*>(
Kopete::AccountManager::self()->
findAccount(pluginId(), accountId));
if(!theAccount)
{
return 0;
}
theAccount->addContact(contactId, metaContact, Kopete::Account::DontChangeKABC);
return theAccount->contacts()[contactId];
}
const Kopete::OnlineStatus MeanwhileProtocol::accountOfflinetqStatus()
{
return statusAccountOffline;
}
const Kopete::OnlineStatus MeanwhileProtocol::lookuptqStatus(
enum Kopete::OnlineStatusManager::Categories cats)
{
return Kopete::OnlineStatusManager::self()->onlinetqStatus(this, cats);
}
#include "meanwhileprotocol.moc"
|