p->attachSlot(SIGNAL(identityRemoved(IdentityId)), this, SLOT(coreIdentityRemoved(IdentityId)));
p->attachSignal(this, SIGNAL(requestCreateNetwork(const NetworkInfo &)), SIGNAL(createNetwork(const NetworkInfo &)));
- p->attachSignal(this, SIGNAL(requestUpdateNetwork(const NetworkInfo &)), SIGNAL(updateNetwork(const NetworkInfo &)));
p->attachSignal(this, SIGNAL(requestRemoveNetwork(NetworkId)), SIGNAL(removeNetwork(NetworkId)));
p->attachSlot(SIGNAL(networkCreated(NetworkId)), this, SLOT(coreNetworkCreated(NetworkId)));
p->attachSlot(SIGNAL(networkRemoved(NetworkId)), this, SLOT(coreNetworkRemoved(NetworkId)));
emit instance()->requestCreateNetwork(info);
}
-void Client::updateNetwork(const NetworkInfo &info) {
- emit instance()->requestUpdateNetwork(info);
-}
-
void Client::removeNetwork(NetworkId id) {
emit instance()->requestRemoveNetwork(id);
}
+void Client::updateNetwork(const NetworkInfo &info) {
+ Network *netptr = instance()->_networks.value(info.networkId, 0);
+ if(!netptr) {
+ qWarning() << "Update for unknown network requested:" << info;
+ return;
+ }
+ netptr->requestSetNetworkInfo(info);
+}
+
void Client::addNetwork(Network *net) {
net->setProxy(signalProxy());
signalProxy()->synchronize(net);
}
void Client::updateIdentity(IdentityId id, const QVariantMap &ser) {
- //emit instance()->requestUpdateIdentity(id);
Identity *idptr = instance()->_identities.value(id, 0);
if(!idptr) {
qWarning() << "Update for unknown identity requested:" << id;
void networkRemoved(NetworkId id);
void requestCreateNetwork(const NetworkInfo &info);
- void requestUpdateNetwork(const NetworkInfo &info);
void requestRemoveNetwork(NetworkId);
public slots:
D_CHANMODE = 0x08
};
-
+
Network(const NetworkId &networkid, QObject *parent = 0);
~Network();
ChannelModeType channelModeType(const QString &mode);
inline ChannelModeType channelModeType(const QCharRef &mode) { return channelModeType(QString(mode)); }
-
+
inline const QString &networkName() const { return _networkName; }
inline const QString ¤tServer() const { return _currentServer; }
inline const QString &myNick() const { return _myNick; }
virtual QVariantMap initIrcUsersAndChannels() const;
// QStringList initIrcUsers() const;
// QStringList initIrcChannels() const;
-
+
//init seters
void initSetSupports(const QVariantMap &supports);
inline void initSetServerList(const QVariantList &serverList) { setServerList(serverList); }
virtual void initSetIrcUsersAndChannels(const QVariantMap &usersAndChannels);
// void initSetIrcUsers(const QStringList &hostmasks);
// void initSetIrcChannels(const QStringList &channels);
-
+
IrcUser *updateNickFromMask(const QString &mask);
// these slots are to keep the hashlists of all users and the
virtual inline void requestConnect() const { emit connectRequested(); }
virtual inline void requestDisconnect() const { emit disconnectRequested(); }
+ virtual inline void requestSetNetworkInfo(const NetworkInfo &info) { emit setNetworkInfoRequested(info); }
void emitConnectionError(const QString &);
void connectRequested(NetworkId id = 0) const;
void disconnectRequested(NetworkId id = 0) const;
+ void setNetworkInfoRequested(const NetworkInfo &) const;
private:
QPointer<SignalProxy> _proxy;
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
+#include "core.h"
#include "corenetwork.h"
#include "coresession.h"
}
emit disconnectRequested(networkId());
}
+
+void CoreNetwork::requestSetNetworkInfo(const NetworkInfo &info) {
+ setNetworkInfo(info);
+ Core::updateNetwork(coreSession()->user(), info);
+}
public slots:
virtual void requestConnect() const;
virtual void requestDisconnect() const;
+ virtual void requestSetNetworkInfo(const NetworkInfo &info);
private:
CoreSession *_coreSession;
p->attachSignal(this, SIGNAL(networkCreated(NetworkId)));
p->attachSignal(this, SIGNAL(networkRemoved(NetworkId)));
p->attachSlot(SIGNAL(createNetwork(const NetworkInfo &)), this, SLOT(createNetwork(const NetworkInfo &)));
- p->attachSlot(SIGNAL(updateNetwork(const NetworkInfo &)), this, SLOT(updateNetwork(const NetworkInfo &)));
p->attachSlot(SIGNAL(removeNetwork(NetworkId)), this, SLOT(removeNetwork(NetworkId)));
loadSettings();
emit networkCreated(id);
} else {
quWarning() << qPrintable(tr("CoreSession::createNetwork(): Trying to create a network that already exists, updating instead!"));
- updateNetwork(info);
+ _networks[info.networkId]->requestSetNetworkInfo(info);
}
}
-// FIXME: move to CoreNetwork
-void CoreSession::updateNetwork(const NetworkInfo &info) {
- if(!_networks.contains(info.networkId)) {
- quWarning() << "Update request for unknown network received!";
- return;
- }
- _networks[info.networkId]->setNetworkInfo(info);
- Core::updateNetwork(user(), info);
-}
-
void CoreSession::removeNetwork(NetworkId id) {
// Make sure the network is disconnected!
NetworkConnection *conn = _connections.value(id, 0);
*/
void createNetwork(const NetworkInfo &info);
- //! Update a network and propagate the changes to the clients.
- /** \param info The updated network settings.
- */
- void updateNetwork(const NetworkInfo &info);
-
//! Remove identity and propagate that fact to the clients.
/** \param identity The identity to be removed.
*/
void destroyNetwork(NetworkId);
void identityUpdated(const QVariantMap &);
- //void networkUpdated(const QVariantMap &);
//! Called when storage updated a BufferInfo.
/** This emits bufferInfoUpdated() via SignalProxy, iff it's one of our buffers.
}
QListWidgetItem *NetworksSettingsPage::networkItem(NetworkId id) const {
- for(int i = 0; i < ui.networkList->count(); i++) {
+ for(int i = 0; i < ui.networkList->count(); i++) {
QListWidgetItem *item = ui.networkList->item(i);
if(item->data(Qt::UserRole).value<NetworkId>() == id) return item;
}