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.
18 #include "psycproto.h"
23 MyMessage (const PsycEntity
&aUser
, const QString
&aText
, const QString
&aAction
, const QDateTime
&aTime
);
32 class PsycContact
: public QObject
{
36 PsycContact (const QString
&uni
, bool aTemp
=false, QObject
*parent
=0);
39 inline PsycEntity
*entity () const { return mEntity
; }
40 inline bool isPlace () const { return mIsPlace
; }
42 inline const QString
&verbatim () const { return mEntity
->verbatim(); }
43 inline void setVerbatim (const QString
&handle
) { mEntity
->setVerbatim(handle
); }
45 inline const QString
&nick () const { return mEntity
->nick(); }
46 inline const QString
&uni () const { return mEntity
->uni(); }
48 inline bool isTemp () const { return mTemp
; }
49 inline void setTemp (bool v
) { mTemp
= v
; }
51 inline bool isOTRActive () const { return mIsOTRActive
; }
52 inline void setOTRActive (bool v
) { mIsOTRActive
= v
; }
54 inline bool isOTRVerified () const { return mIsOTRVerified
; }
55 inline void setOTRVerified (bool v
) { mIsOTRVerified
= v
; }
57 inline PsycProto::Status
status () const { return mEntity
->status(); }
58 inline void setStatus (PsycProto::Status st
) { mEntity
->setStatus(st
); }
60 inline QString
statusText () const { return mEntity
->statusText(); }
61 inline void setStatusText (const QString
&v
) { mEntity
->setStatusText(v
); }
63 inline PsycProto::Mood
mood () const { return mEntity
->mood(); }
64 inline void setMood (PsycProto::Mood v
) { mEntity
->setMood(v
); }
66 inline uint
lastSeenUnix () const { return mLastSeen
; }
67 inline QDateTime
lastSeen () const { return QDateTime::fromTime_t(mLastSeen
); }
68 inline void setLastSeen (const uint
&dt
) { mLastSeen
= dt
; }
69 inline void setLastSeen (const QDateTime
&dt
) { mLastSeen
= dt
.toTime_t(); }
71 inline bool authorized () const { return mAuthorized
; }
72 inline void setAuthorized (bool auth
) { mAuthorized
= auth
; }
74 inline const QString
&groupName () const { return mGroupName
; }
75 inline void setGroupName (const QString
&gn
) { mGroupName
= gn
; }
77 void addMessage (const PsycEntity
&aUser
, const QString
&aText
, const QString
&aAction
, const QDateTime
&aTime
);
78 inline int messageCount () const { return mMsgList
.count(); }
79 void clearMessages ();
80 QList
<MyMessage
*> messages ();
83 inline int personCount () const { return mPersonList
.count(); }
84 inline void clearPersons () { return mPersonList
.clear(); }
85 void addPerson (const QString
&uni
);
86 void delPerson (const QString
&uni
);
87 bool hasPerson (const QString
&uni
) const;
88 QStringList
persons () const;
89 QString
person (int idx
) const;
96 QList
<MyMessage
*> mMsgList
;
97 QStringList mPersonList
;
99 // temporary contacts will not be shown in clist and will not be stored in db
100 // i need 'em to make api.contactInfo() works