--- /dev/null
+SELECT awaymessage
+FROM network
+WHERE userid = :userid AND networkid = :networkid
--- /dev/null
+SELECT usermode
+FROM network
+WHERE userid = :userid AND networkid = :networkid
\ No newline at end of file
--- /dev/null
+UPDATE network
+SET awaymessage = :awaymsg
+WHERE userid = :userid AND networkid = :networkid
--- /dev/null
+UPDATE network
+SET usermode = :usermode
+WHERE userid = :userid AND networkid = :networkid
\ No newline at end of file
return instance()->storage->setPersistentChannelKey(user, networkId, channel, key);
}
+ //! retrieve last known away message for session restore
+ /** \note This method is threadsafe
+ *
+ * \param user The Id of the networks owner
+ * \param networkId The Id of the network
+ */
+ static inline QString awayMessage(UserId user, NetworkId networkId) {
+ return instance()->storage->awayMessage(user, networkId);
+ }
+
+ //! Make away message persistent for session restore
+ /** \note This method is threadsafe
+ *
+ * \param user The Id of the networks owner
+ * \param networkId The Id of the network
+ * \param awayMsg The current away message of own user
+ */
+ static inline void setAwayMessage(UserId user, NetworkId networkId, const QString &awayMsg) {
+ return instance()->storage->setAwayMessage(user, networkId, awayMsg);
+ }
+
+ //! retrieve last known user mode for session restore
+ /** \note This method is threadsafe
+ *
+ * \param user The Id of the networks owner
+ * \param networkId The Id of the network
+ */
+ static inline QString userModes(UserId user, NetworkId networkId) {
+ return instance()->storage->userModes(user, networkId);
+ }
+
+ //! Make our user modes persistent for session restore
+ /** \note This method is threadsafe
+ *
+ * \param user The Id of the networks owner
+ * \param networkId The Id of the network
+ * \param userModes The current user modes of own user
+ */
+ static inline void setUserModes(UserId user, NetworkId networkId, const QString &userModes) {
+ return instance()->storage->setUserModes(user, networkId, userModes);
+ }
+
//! Get the unique BufferInfo for the given combination of network and buffername for a user.
/** \note This method is threadsafe.
*
_quitRequested = requested; // see socketDisconnected();
_autoReconnectTimer.stop();
_autoReconnectCount = 0; // prohibiting auto reconnect
+
+ IrcUser *me_ = me();
+ if(me_) {
+ QString awayMsg;
+ if(me_->isAway())
+ awayMsg = me_->awayMessage();
+ Core::setAwayMessage(userId(), networkId(), awayMsg);
+ Core::setUserModes(userId(), networkId(), me_->userModes());
+ }
+
displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("Disconnecting."));
if(socket.state() == QAbstractSocket::UnconnectedState) {
socketDisconnected();
<file>./SQL/SQLite/14/select_messagesAllNew.sql</file>
<file>./SQL/SQLite/14/select_messagesNewerThan.sql</file>
<file>./SQL/SQLite/14/select_messagesNewestK.sql</file>
+ <file>./SQL/SQLite/14/select_network_awaymsg.sql</file>
+ <file>./SQL/SQLite/14/select_network_usermode.sql</file>
<file>./SQL/SQLite/14/select_networkExists.sql</file>
<file>./SQL/SQLite/14/select_networks_for_user.sql</file>
<file>./SQL/SQLite/14/select_nicks.sql</file>
<file>./SQL/SQLite/14/update_identity.sql</file>
<file>./SQL/SQLite/14/update_network.sql</file>
<file>./SQL/SQLite/14/update_network_connected.sql</file>
+ <file>./SQL/SQLite/14/update_network_set_awaymsg.sql</file>
+ <file>./SQL/SQLite/14/update_network_set_usermode.sql</file>
<file>./SQL/SQLite/14/update_user_setting.sql</file>
<file>./SQL/SQLite/14/update_username.sql</file>
<file>./SQL/SQLite/14/update_userpassword.sql</file>
watchQuery(query);
}
+QString SqliteStorage::awayMessage(UserId user, NetworkId networkId) {
+ QSqlQuery query(logDb());
+ query.prepare(queryString("select_network_awaymsg"));
+ query.bindValue(":userid", user.toInt());
+ query.bindValue(":networkid", networkId.toInt());
+ safeExec(query);
+ watchQuery(query);
+ QString awayMsg;
+ if(query.first())
+ awayMsg = query.value(0).toString();
+ return awayMsg;
+}
+
+void SqliteStorage::setAwayMessage(UserId user, NetworkId networkId, const QString &awayMsg) {
+ QSqlQuery query(logDb());
+ query.prepare(queryString("update_network_set_awaymsg"));
+ query.bindValue(":userid", user.toInt());
+ query.bindValue(":networkid", networkId.toInt());
+ query.bindValue(":awaymsg", awayMsg);
+ safeExec(query);
+ watchQuery(query);
+}
+
+QString SqliteStorage::userModes(UserId user, NetworkId networkId) {
+ QSqlQuery query(logDb());
+ query.prepare(queryString("select_network_usermode"));
+ query.bindValue(":userid", user.toInt());
+ query.bindValue(":networkid", networkId.toInt());
+ safeExec(query);
+ watchQuery(query);
+ QString modes;
+ if(query.first())
+ modes = query.value(0).toString();
+ return modes;
+}
+
+void SqliteStorage::setUserModes(UserId user, NetworkId networkId, const QString &userModes) {
+ QSqlQuery query(logDb());
+ query.prepare(queryString("update_network_set_usermode"));
+ query.bindValue(":userid", user.toInt());
+ query.bindValue(":networkid", networkId.toInt());
+ query.bindValue(":usermode", userModes);
+ safeExec(query);
+ watchQuery(query);
+}
void SqliteStorage::createBuffer(UserId user, const NetworkId &networkId, BufferInfo::Type type, const QString &buffer) {
QSqlQuery query(logDb());
virtual void setChannelPersistent(UserId user, const NetworkId &networkId, const QString &channel, bool isJoined);
virtual void setPersistentChannelKey(UserId user, const NetworkId &networkId, const QString &channel, const QString &key);
+ /* persistent user states */
+ virtual QString awayMessage(UserId user, NetworkId networkId);
+ virtual void setAwayMessage(UserId user, NetworkId networkId, const QString &awayMsg);
+ virtual QString userModes(UserId user, NetworkId networkId);
+ virtual void setUserModes(UserId user, NetworkId networkId, const QString &userModes);
+
/* Buffer handling */
virtual BufferInfo bufferInfo(UserId user, const NetworkId &networkId, BufferInfo::Type type, const QString &buffer = "", bool create = true);
virtual BufferInfo getBufferInfo(UserId user, const BufferId &bufferId);
* \param key The key of the channel (possibly empty)
*/
virtual void setPersistentChannelKey(UserId user, const NetworkId &networkId, const QString &channel, const QString &key) = 0;
-
+
+ //! retrieve last known away message for session restore
+ /** \note This method is threadsafe
+ *
+ * \param user The Id of the networks owner
+ * \param networkId The Id of the network
+ */
+ virtual QString awayMessage(UserId user, NetworkId networkId) = 0;
+
+ //! Make away message persistent for session restore
+ /** \note This method is threadsafe
+ *
+ * \param user The Id of the networks owner
+ * \param networkId The Id of the network
+ * \param awayMsg The current away message of own user
+ */
+ virtual void setAwayMessage(UserId user, NetworkId networkId, const QString &awayMsg) = 0;
+
+
+ //! retrieve last known user mode for session restore
+ /** \note This method is threadsafe
+ *
+ * \param user The Id of the networks owner
+ * \param networkId The Id of the network
+ */
+ virtual QString userModes(UserId user, NetworkId networkId) = 0;
+
+ //! Make our user modes persistent for session restore
+ /** \note This method is threadsafe
+ *
+ * \param user The Id of the networks owner
+ * \param networkId The Id of the network
+ * \param userModes The current user modes of own user
+ */
+ virtual void setUserModes(UserId user, NetworkId networkId, const QString &userModes) = 0;
+
+
/* Buffer handling */
//! Get the unique BufferInfo for the given combination of network and buffername for a user.