1 /* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar)
2 * Understanding is not required. Only obedience.
4 * This program is free software. It comes without any warranty, to
5 * the extent permitted by applicable law. You can redistribute it
6 * and/or modify it under the terms of the Do What The Fuck You Want
7 * To Public License, Version 2, as published by Sam Hocevar. See
8 * http://sam.zoy.org/wtfpl/COPYING for more details.
12 #include "psyccontact.h"
15 MyMessage::MyMessage (const PsycEntity
&aUser
, const QString
&aText
, const QString
&aAction
, const QDateTime
&aTime
) :
16 text(aText
), action(aAction
), time(aTime
), user(aUser
)
21 ///////////////////////////////////////////////////////////////////////////////
22 PsycContact::PsycContact (const QString
&uni
, bool aTemp
, QObject
*parent
) :
23 QObject(parent
), mEntity(new PsycEntity(uni
)),
25 mAuthorized(false), mGroupName(QString()),
27 mTemp(aTemp
), mIsOTRActive(false), mIsOTRVerified(false)
29 mIsPlace
= mEntity
->isPlace();
33 PsycContact::~PsycContact () {
40 ///////////////////////////////////////////////////////////////////////////////
41 void PsycContact::addMessage (const PsycEntity
&aUser
, const QString
&aText
, const QString
&aAction
, const QDateTime
&aTime
) {
42 MyMessage
*msg
= new MyMessage(aUser
, aText
, aAction
, aTime
);
47 void PsycContact::clearMessages () {
48 foreach (MyMessage
*msg
, mMsgList
) delete msg
;
53 QList
<MyMessage
*> PsycContact::messages () {
54 QList
<MyMessage
*> res(mMsgList
);
59 ///////////////////////////////////////////////////////////////////////////////
60 void PsycContact::addPerson (const QString
&uni
) {
61 if (mPersonList
.indexOf(uni
.toLower()) < 0) mPersonList
<< uni
;
65 void PsycContact::delPerson (const QString
&uni
) {
66 int idx
= mPersonList
.indexOf(uni
.toLower());
67 if (idx
>= 0) mPersonList
.removeAt(idx
);
71 bool PsycContact::hasPerson (const QString
&uni
) const {
72 return mPersonList
.contains(uni
.toLower());
76 QStringList
PsycContact::persons () const {
81 QString
PsycContact::person (int idx
) const {
82 if (idx
< 0 || idx
>= mPersonList
.count()) return QString("");
83 return mPersonList
[idx
];