if(msg.type() == Message::Plain || msg.type() == Message::Notice)
level |= BufferItem::NewMessage;
- if(msg.flags() & Message::Highlight)
+ const Network *net = Client::network(msg.bufferInfo().networkId());
+ if(net && msg.text().contains(net->myNick()))
level |= BufferItem::Highlight;
bufferItem(msg.bufferInfo())->updateActivity(level);
public:
/** The different types a message can have for display */
- enum Type { Plain, Notice, Action, Nick, Mode, Join, Part, Quit, Kick, Kill, Server, Info, Error };
- enum Flags { None = 0, Self = 1, PrivMsg = 2, Highlight = 4 };
+ enum Type {
+ Plain,
+ Notice,
+ Action,
+ Nick,
+ Mode,
+ Join,
+ Part,
+ Quit,
+ Kick,
+ Kill,
+ Server,
+ Info,
+ Error
+ };
+
+ enum Flags {
+ None = 0,
+ Self = 1
+ };
+ Q_DECLARE_FLAGS(MessageFlags, Flags)
+
Message(BufferInfo bufferInfo = BufferInfo(), Type type = Plain, QString text = "", QString sender = "", quint8 flags = None);
QDataStream &operator>>(QDataStream &in, Message &msg);
Q_DECLARE_METATYPE(Message);
+Q_DECLARE_OPERATORS_FOR_FLAGS(Message::MessageFlags)
#endif
--- /dev/null
+UPDATE backlog SET flags = flags & 1
--- /dev/null
+UPDATE coreinfo
+SET value='3'
+WHERE key = 'schemaversion'
void CoreSession::recvMessageFromServer(Message::Type type, QString target, QString text, QString sender, quint8 flags) {
NetworkConnection *netCon = qobject_cast<NetworkConnection*>(this->sender());
Q_ASSERT(netCon);
-
- QString bufferName;
- if((flags & Message::PrivMsg) && !(flags & Message::Self))
- bufferName = nickFromMask(sender);
- else
- bufferName = target;
-
- BufferInfo bufferInfo = Core::bufferInfo(user(), netCon->networkId(), bufferName);
+
+ BufferInfo bufferInfo = Core::bufferInfo(user(), netCon->networkId(), target);
Message msg(bufferInfo, type, text, sender, flags);
msg.setMsgId(Core::storeMessage(msg));
Q_ASSERT(msg.msgId() != 0);
return dequotedMessage;
}
-QStringList CtcpHandler::parse(CtcpType ctcptype, QString prefix, QString target, QString message) {
- QStringList messages;
+void CtcpHandler::parse(Message::Type messageType, QString prefix, QString target, QString message) {
QString ctcp;
//lowlevel message dequote
QString dequotedMessage = dequote(message);
-
+
+ CtcpType ctcptype = (messageType == Message::Notice)
+ ? CtcpReply
+ : CtcpQuery;
+
// extract tagged / extended data
while(dequotedMessage.contains(XDELIM)) {
- if(dequotedMessage.indexOf(XDELIM) > 0)
- messages << dequotedMessage.section(XDELIM,0,0);
+ if(dequotedMessage.indexOf(XDELIM) > 0)
+ emit displayMsg(messageType, target, dequotedMessage.section(XDELIM,0,0), prefix);
+ // messages << dequotedMessage.section(XDELIM,0,0), prefix);
ctcp = XdelimDequote(dequotedMessage.section(XDELIM,1,1));
dequotedMessage = dequotedMessage.section(XDELIM,2,2);
handle(ctcpcmd, Q_ARG(CtcpType, ctcptype), Q_ARG(QString, prefix), Q_ARG(QString, target), Q_ARG(QString, ctcpparam));
}
- if(!dequotedMessage.isEmpty()) {
- messages << dequotedMessage;
- }
- return messages;
+
+ if(!dequotedMessage.isEmpty())
+ emit displayMsg(messageType, target, dequotedMessage, prefix);
+
}
QString CtcpHandler::pack(QString ctcpTag, QString message) {
enum CtcpType {CtcpQuery, CtcpReply};
- QStringList parse(CtcpType, QString prefix, QString target, QString message);
+ void parse(Message::Type, QString prefix, QString target, QString message);
QString dequote(QString);
QString XdelimDequote(QString);
}
void IrcServerHandler::handleNotice(QString prefix, QList<QByteArray> params) {
- if(network()->currentServer().isEmpty() || network()->currentServer() == prefix)
+ if(params.count() < 2) {
+ qWarning() << "IrcServerHandler::handleNotice(): not enoug Parameters:" << prefix << serverDecode(params);
+ return;
+ }
+
+ // check if it's only a Server Message or if it's a regular Notice
+ if(network()->currentServer().isEmpty() || network()->currentServer() == prefix) {
emit displayMsg(Message::Server, "", serverDecode(params[1]), prefix);
- else
- emit displayMsg(Message::Notice, "", userDecode(prefix, params[1]), prefix);
+ return;
+ }
+
+ QString target = serverDecode(params[0]);
+
+ // are we the target?
+ if(network()->isMyNick(target))
+ target = nickFromMask(target);
+
+ networkConnection->ctcpHandler()->parse(Message::Notice, prefix, target, userDecode(prefix, params[1]));
}
void IrcServerHandler::handlePart(QString prefix, QList<QByteArray> params) {
QString target = serverDecode(params[0]);
- // are we the target or is it a channel?
- if(network()->isMyNick(target)) {
- // it's possible to pack multiple privmsgs into one param using ctcp
- QStringList messages = networkConnection->ctcpHandler()->parse(CtcpHandler::CtcpQuery, prefix, target, userDecode(ircuser->nick(), params[1]));
- quint8 flags;
- foreach(QString message, messages) {
- flags = Message::PrivMsg;
- if(message.contains(network()->myNick()))
- flags |= Message::Highlight;
- emit displayMsg(Message::Plain, "", message, prefix, flags);
- }
- } else {
- // so it's probably a channel..
- if(!isChannelName(target)) {
- qWarning() << "received PRIVMSG with target" << target << "which is neither us nor a channel!";
- return;
- }
+ // are we the target?
+ if(network()->isMyNick(target))
+ target = nickFromMask(target);
- QStringList messages = networkConnection->ctcpHandler()->parse(CtcpHandler::CtcpQuery, prefix, target, bufferDecode(target, params[1]));
- quint8 flags;
- foreach(QString message, messages) {
- flags = Message::None;
- if(message.contains(network()->myNick()))
- flags |= Message::Highlight;
- emit displayMsg(Message::Plain, target, message, prefix, flags);
- }
- }
+ // it's possible to pack multiple privmsgs into one param using ctcp
+ // - > we let the ctcpHandler do the work
+ networkConnection->ctcpHandler()->parse(Message::Plain, prefix, target, userDecode(ircuser->nick(), params[1]));
+// QStringList messages =
+// foreach(QString message, messages) {
+// emit displayMsg(Message::Plain, target, message, prefix);
+// }
+
}
void IrcServerHandler::handleQuit(QString prefix, QList<QByteArray> params) {
<file>./SQL/SQLite/1/upgrade_000_drop_coreinfo.sql</file>
<file>./SQL/SQLite/1/upgrade_010_create_coreinfo.sql</file>
<file>./SQL/SQLite/1/upgrade_020_update_schemaversion.sql</file>
- <file>./SQL/SQLite/2/delete_backlog_by_uid.sql</file>
- <file>./SQL/SQLite/2/delete_buffers_by_uid.sql</file>
- <file>./SQL/SQLite/2/delete_networks_by_uid.sql</file>
- <file>./SQL/SQLite/2/delete_quasseluser.sql</file>
- <file>./SQL/SQLite/2/insert_buffer.sql</file>
- <file>./SQL/SQLite/2/insert_message.sql</file>
- <file>./SQL/SQLite/2/insert_network.sql</file>
- <file>./SQL/SQLite/2/insert_quasseluser.sql</file>
- <file>./SQL/SQLite/2/insert_sender.sql</file>
- <file>./SQL/SQLite/2/select_authuser.sql</file>
- <file>./SQL/SQLite/2/select_bufferByName.sql</file>
- <file>./SQL/SQLite/2/select_buffers.sql</file>
- <file>./SQL/SQLite/2/select_lastMessage.sql</file>
- <file>./SQL/SQLite/2/select_messageRange.sql</file>
- <file>./SQL/SQLite/2/select_messages.sql</file>
- <file>./SQL/SQLite/2/select_messagesOffset.sql</file>
- <file>./SQL/SQLite/2/select_messagesSince.sql</file>
- <file>./SQL/SQLite/2/select_messagesSinceOffset.sql</file>
- <file>./SQL/SQLite/2/select_userid.sql</file>
- <file>./SQL/SQLite/2/setup_000_quasseluser.sql</file>
- <file>./SQL/SQLite/2/setup_010_sender.sql</file>
- <file>./SQL/SQLite/2/setup_020_network.sql</file>
- <file>./SQL/SQLite/2/setup_040_buffer.sql</file>
- <file>./SQL/SQLite/2/setup_050_buffer_idx.sql</file>
- <file>./SQL/SQLite/2/setup_060_backlog.sql</file>
- <file>./SQL/SQLite/2/setup_070_coreinfo.sql</file>
- <file>./SQL/SQLite/2/setup_080_version.sql</file>
- <file>./SQL/SQLite/2/update_username.sql</file>
- <file>./SQL/SQLite/2/update_userpassword.sql</file>
<file>./SQL/SQLite/2/upgrade_000_drop_buffergroup.sql</file>
<file>./SQL/SQLite/2/upgrade_010_update_schemaversion.sql</file>
+ <file>./SQL/SQLite/3/delete_backlog_by_uid.sql</file>
+ <file>./SQL/SQLite/3/delete_buffers_by_uid.sql</file>
+ <file>./SQL/SQLite/3/delete_networks_by_uid.sql</file>
+ <file>./SQL/SQLite/3/delete_quasseluser.sql</file>
+ <file>./SQL/SQLite/3/insert_buffer.sql</file>
+ <file>./SQL/SQLite/3/insert_message.sql</file>
+ <file>./SQL/SQLite/3/insert_network.sql</file>
+ <file>./SQL/SQLite/3/insert_quasseluser.sql</file>
+ <file>./SQL/SQLite/3/insert_sender.sql</file>
+ <file>./SQL/SQLite/3/select_authuser.sql</file>
+ <file>./SQL/SQLite/3/select_bufferByName.sql</file>
+ <file>./SQL/SQLite/3/select_buffers.sql</file>
+ <file>./SQL/SQLite/3/select_lastMessage.sql</file>
+ <file>./SQL/SQLite/3/select_messageRange.sql</file>
+ <file>./SQL/SQLite/3/select_messages.sql</file>
+ <file>./SQL/SQLite/3/select_messagesOffset.sql</file>
+ <file>./SQL/SQLite/3/select_messagesSince.sql</file>
+ <file>./SQL/SQLite/3/select_messagesSinceOffset.sql</file>
+ <file>./SQL/SQLite/3/select_userid.sql</file>
+ <file>./SQL/SQLite/3/setup_000_quasseluser.sql</file>
+ <file>./SQL/SQLite/3/setup_010_sender.sql</file>
+ <file>./SQL/SQLite/3/setup_020_network.sql</file>
+ <file>./SQL/SQLite/3/setup_040_buffer.sql</file>
+ <file>./SQL/SQLite/3/setup_050_buffer_idx.sql</file>
+ <file>./SQL/SQLite/3/setup_060_backlog.sql</file>
+ <file>./SQL/SQLite/3/setup_070_coreinfo.sql</file>
+ <file>./SQL/SQLite/3/setup_080_version.sql</file>
+ <file>./SQL/SQLite/3/update_username.sql</file>
+ <file>./SQL/SQLite/3/update_userpassword.sql</file>
+ <file>./SQL/SQLite/3/upgrade_000_update_backlog_flags.sql</file>
+ <file>./SQL/SQLite/3/upgrade_010_update_schemaversion.sql</file>
</qresource>
</RCC>
// TODO: show privmsgs
void UserInputHandler::handleMsg(QString bufname, QString msg) {
Q_UNUSED(bufname)
- QString nick = msg.section(" ", 0, 0);
- msg = msg.section(" ", 1);
- if(nick.isEmpty() || msg.isEmpty()) return;
+ if(!msg.contains(' '))
+ return;
+
QStringList params;
- params << nick << msg;
- emit putCmd("PRIVMSG", params);
+ params << msg.section(' ', 0, 0);
+ params << msg.section(' ', 1);
+
+ emit putCmd("PRIVMSG", msg.split(' '));
}
void UserInputHandler::handleNick(QString bufname, QString msg) {
// TODO: implement queries
void UserInputHandler::handleQuery(QString bufname, QString msg) {
- // QString nick = msg.section(' ', 0, 0);
-
+ Q_UNUSED(bufname)
+ QString target = msg.section(' ', 0, 0);
+ QString message = msg.section(' ', 1);
+ if(message.isEmpty())
+ emit displayMsg(Message::Server, target, "Starting query with " + target, network()->myNick(), Message::Self);
+ else
+ emit displayMsg(Message::Plain, target, message, network()->myNick(), Message::Self);
handleMsg(bufname, msg);
-
- // TODO: usenetworkids
-// if(!nick.isEmpty())
-// emit queryRequested(network, nick);
}
void UserInputHandler::handleQuit(QString bufname, QString msg) {
QStringList params;
params << bufname << msg;
emit putCmd("PRIVMSG", params);
- if(isChannelName(bufname)) {
- emit displayMsg(Message::Plain, params[0], msg, network()->myNick(), Message::Self);
- } else {
- emit displayMsg(Message::Plain, params[0], msg, network()->myNick(), Message::Self|Message::PrivMsg);
- }
+ emit displayMsg(Message::Plain, params[0], msg, network()->myNick(), Message::Self);
}
void UserInputHandler::handleTopic(QString bufname, QString msg) {
quasselVersion = "0.2.0-pre";
quasselDate = "2008-02-03";
- quasselBuild = 445;
+ quasselBuild = 447;
//! Minimum client build number the core needs
clientBuildNeeded = 437;