summaryrefslogtreecommitdiffstats
path: root/konversation/src/identity.h
blob: 7033fcb37e3e2eb750317114e33a36df876b5b77 (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
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
127
128
129
130
131
132
133
/*
  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.
*/

/*
  This class holds the various user identities
  begin:     Son Feb 9 2003
  copyright: (C) 2003 by Dario Abatianni
  email:     eisfuchs@tigress.com
*/

#ifndef IDENTITY_H
#define IDENTITY_H

#include <ksharedptr.h>
#include <tqstringlist.h>


class TQTextCodec;

class Identity : public TDEShared
{
    public:
        /// Create an Identity with a new id.
        Identity();
        /// Create a new Identity with a set id.
        explicit Identity(int id);
        /// Copy all of @param original including the id.
        Identity(const Identity& original);
        ~Identity();

        /// This function copies all of @param original but the id
        void copy(const Identity& original);

        void setName(const TQString& name);        // the name of this identity
        TQString getName() const;

        void setRealName(const TQString& name);
        TQString getRealName() const;
        void setIdent(const TQString& ident);
        TQString getIdent() const;

        void setNickname(uint index,const TQString& nick);
        TQString getNickname(uint index) const;

        void setBot(const TQString& bot);
        TQString getBot() const;
        void setPassword(const TQString& password);
        TQString getPassword() const;

        void setNicknameList(const TQStringList& newList);
        TQStringList getNicknameList() const;

        void setQuitReason(const TQString& reason);
        TQString getQuitReason() const;
        void setPartReason(const TQString& reason);
        TQString getPartReason() const;
        void setKickReason(const TQString& reason);
        TQString getKickReason() const;

        void setInsertRememberLineOnAway(bool state);
        bool getInsertRememberLineOnAway() const;
        void setShowAwayMessage(bool state);
        bool getShowAwayMessage() const;

        void setAwayMessage(const TQString& message);
        TQString getAwayMessage() const;
        void setReturnMessage(const TQString& message);
        TQString getReturnMessage() const;

        void setAutomaticAway(bool automaticAway);
        bool getAutomaticAway() const;
        void setAwayInactivity(int awayInactivity);
        int getAwayInactivity() const;
        void setAutomaticUnaway(bool automaticUnaway);
        bool getAutomaticUnaway() const;

        void setShellCommand(const TQString &command);
        TQString getShellCommand() const;

        void setCodecName(const TQString &newCodecName);
        TQString getCodecName() const;
        TQTextCodec* getCodec() const;

        TQString getAwayNick() const;
        void setAwayNick(const TQString& n);

        int id() const { return m_id; }

    protected:
        TQString name;

        TQString bot;
        TQString password;

        TQString realName;
        TQString ident;

        TQStringList nicknameList;

        TQString partReason;
        TQString quitReason;
        TQString kickReason;

        bool insertRememberLineOnAway;
        bool showAwayMessages;
        TQString awayMessage;
        TQString returnMessage;

        bool m_automaticAway;
        int m_awayInactivity;
        bool m_automaticUnaway;

        TQString m_codecName;
        TQTextCodec* m_codec;

        TQString m_shellCommand;

        TQString awayNick;

    private:
        int m_id;
        static int s_availableId;
        void init();
};

typedef TDESharedPtr<Identity> IdentityPtr;
typedef TQValueList<IdentityPtr> IdentityList;

#endif