- // FIXME commented for debugging
- /*
- disconnect(this, SLOT(ircUserJoinedOrParted(IrcUser *)));
- connect(channel, SIGNAL(ircUserJoined(IrcUser *)),
- this, SLOT(ircUserJoinedOrParted(IrcUser *)));
- connect(channel, SIGNAL(ircUserParted(IrcUser *)),
- this, SLOT(ircUserJoinedOrParted(IrcUser *)));
- */
-
- completionList.clear();
- QString tabAbbrev = inputLine->text().left(inputLine->cursorPosition()).section(' ',-1,-1);
- completionList.clear();
- QRegExp regex(QString("^[^a-zA-Z]*").append(tabAbbrev), Qt::CaseInsensitive);
- QMap<QString, QString> sortMap;
-
- foreach(IrcUser *ircUser, channel->ircUsers()) {
- if(regex.indexIn(ircUser->nick()) > -1) {
- sortMap[ircUser->nick().toLower()] = ircUser->nick();
+ QString tabAbbrev = _lineEdit->text().left(_lineEdit->cursorPosition()).section(QRegExp("[^\\w\\d-_\\[\\]{}|`^.\\\\]"),-1,-1);
+ QRegExp regex(QString("^[-_\\[\\]{}|`^.\\\\]*").append(QRegExp::escape(tabAbbrev)), Qt::CaseInsensitive);
+
+ switch(static_cast<BufferInfo::Type>(currentIndex.data(NetworkModel::BufferTypeRole).toInt())) {
+ case BufferInfo::ChannelBuffer:
+ { // scope is needed for local var declaration
+ IrcChannel *channel = _currentNetwork->ircChannel(bufferName);
+ if(!channel)
+ return;
+ foreach(IrcUser *ircUser, channel->ircUsers()) {
+ if(regex.indexIn(ircUser->nick()) > -1)
+ _completionMap[ircUser->nick().toLower()] = ircUser->nick();
+ }