-// this would be the place for a client-side hook
-void ClientUserInputHandler::handleUserInput(const BufferInfo &bufferInfo, const QString &msg_) {
- QString msg = msg_;
-
- if(!_initialized) { // aliases not yet synced
- _inputBuffer.append(qMakePair(bufferInfo, msg));
- return;
- }
-
- // leading slashes indicate there's a command to call unless there is another one in the first section (like a path /proc/cpuinfo)
- int secondSlashPos = msg.indexOf('/', 1);
- int firstSpacePos = msg.indexOf(' ');
- if(!msg.startsWith('/') || (secondSlashPos != -1 && (secondSlashPos < firstSpacePos || firstSpacePos == -1))) {
- if(msg.startsWith("//"))
- msg.remove(0, 1); // //asdf is transformed to /asdf
-
- // check if we addressed a user and update its timestamp in that case
- if(bufferInfo.type() == BufferInfo::ChannelBuffer) {
- if(!msg.startsWith('/')) {
- if(_nickRx.indexIn(msg) == 0) {
- const Network *net = Client::network(bufferInfo.networkId());
- IrcUser *user = net ? net->ircUser(_nickRx.cap(1)) : 0;
- if(user)
- user->setLastSpokenTo(bufferInfo.bufferId(), QDateTime::currentDateTime().toUTC());
- }
- }
- }
- msg.prepend("/SAY "); // make sure we only send proper commands to the core
-
- } else {
- // check for aliases
- QString cmd = msg.section(' ', 0, 0).remove(0, 1).toUpper();
- for(int i = 0; i < _aliasManager.count(); i++) {
- if(_aliasManager[i].name.toLower() == cmd.toLower()) {
- expand(_aliasManager[i].expansion, bufferInfo, msg.section(' ', 1));