2 ircaccount.h - IRC Account
4 Copyright (c) 2002 by Nick Betcher <nbetcher@kde.org>
5 Copyright (c) 2003 by Jason Keirstead <jason@keirstead.org>
6 Copyright (c) 2003-2007 by Michel Hermier <michel.hermier@gmail.com>
8 Kopete (c) 2002-2007 by the Kopete developers <kopete-devel@kde.org>
10 *************************************************************************
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
17 *************************************************************************
23 #include "ircnetwork.h"
25 #include "kircsocket.h"
27 #include "kopetepasswordedaccount.h"
28 #include "kopetemessage.h"
50 : public Kopete::PasswordedAccount
54 Q_PROPERTY(int codecMib READ codecMib WRITE setCodecFromMib
)
55 Q_PROPERTY(QString networkName READ networkName WRITE setNetworkByName
)
57 Q_PROPERTY(QString userName READ userName WRITE setUserName
)
58 Q_PROPERTY(QString realName READ realName WRITE setRealName
)
59 // Q_PROPERTY(QString password READ password WRITE setPassword)
61 Q_PROPERTY(QString nickName READ nickName WRITE setNickName
)
62 // Q_PROPERTY(QStringList nickNames READ nickNames WRITE setNickNames)
64 Q_PROPERTY(QString partMessage READ partMessage WRITE setPartMessage
)
65 Q_PROPERTY(QString quitMessage READ quitMessage WRITE setQuitMessage
)
67 Q_PROPERTY(bool autoShowServerWindow READ autoShowServerWindow WRITE setAutoShowServerWindow
)
70 explicit IRCAccount(const QString
&accountid
, const QString
&autoConnect
= QString(),
71 const QString
& networkName
= QString(), const QString
&nickName
= QString());
72 virtual ~IRCAccount();
74 public: // READ properties accessors.
78 const QString
networkName() const;
80 const QString
userName() const;
82 const QString
realName() const;
84 const QString
nickName() const;
86 // const QString altNick() const;
88 const QString
partMessage() const;
90 const QString
quitMessage() const;
92 bool autoShowServerWindow() const;
94 public slots
: // WRITE properties accessors.
96 void setCodecFromMib(int mib
);
98 void setNetworkByName( const QString
& );
100 void setUserName( const QString
& );
102 void setRealName( const QString
& );
104 void setNickName( const QString
& );
106 void setPartMessage( const QString
& );
108 void setQuitMessage( const QString
& );
110 void setAutoShowServerWindow( bool autoShow
);
113 // Returns the KIRC engine instance
114 KIrc::ClientSocket
*client() const;
116 QTextCodec
*codec() const;
117 void setCodec( QTextCodec
*codec
);
119 // IRCNetwork network();
121 const QStringList
connectCommands() const;
123 void setConnectCommands( const QStringList
& ) const;
127 QMap
< QString
, QString
> customCtcp() const;
129 void setCustomCtcpReplies( const QMap
< QString
, QString
> &replies
);
131 const QMap
<QString
, QString
> customCtcpReplies() const;
133 void setCurrentCommandSource( Kopete::ChatSession
*session
);
135 Kopete::ChatSession
*currentCommandSource();
137 IRCContact
*getContact(const QByteArray
&name
, Kopete::MetaContact
*metac
=0);
138 IRCContact
*getContact(const KIrc::EntityPtr
&entity
, Kopete::MetaContact
*metac
=0);
139 QList
<Kopete::Contact
*> getContacts( const KIrc::EntityList
&entities
);
141 virtual void fillActionMenu( KActionMenu
*actionMenu
);
143 /** Reimplemented from Kopete::Account */
144 virtual void setOnlineStatus(const Kopete::OnlineStatus
&status
, const Kopete::StatusMessage
&statusMessage
,
145 const OnlineStatusOptions
& options
= None
);
147 virtual void setStatusMessage(const Kopete::StatusMessage
&statusMessage
);
149 // Returns the Kopete::Contact of the user
150 IRCContact
*mySelf() const;
152 // Returns the Kopete::Contact of the server of the user
153 IRCContact
*myServer() const;
157 virtual void setAway( bool isAway
, const QString
&awayMessage
= QString() );
159 virtual void connectWithPassword( const QString
& );
161 virtual void disconnect() { quit(); } // REMOVE ME ASAP
164 void quit( const QString
&quitMessage
= QString() );
167 virtual bool createContact( const QString
&contactId
, Kopete::MetaContact
*parentContact
) ;
170 void clientConnectionStateChanged(KIrc::Socket::ConnectionState newstate
);
172 void destroyed(IRCContact
*contact
);
174 void receivedEvent(QEvent
*event
);
176 void slotPerformOnConnectCommands();
178 void slotShowServerWindow();
180 void slotJoinChannel();
184 void clientConnect();
185 void appendMessage(IRCContact
* from
, QList
<Kopete::Contact
*> to
,const QString
& text
, Kopete::Message::MessageType type
);
187 Q_DISABLE_COPY(IRCAccount
)