Improve channelname recognition a bit (don't make #123 clickable)
authorManuel Nickschas <sputnick@quassel-irc.org>
Fri, 2 Jan 2009 18:35:57 +0000 (19:35 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Fri, 2 Jan 2009 18:35:57 +0000 (19:35 +0100)
src/qtui/chatitem.cpp

index 7e6d0e1..b72b8ad 100644 (file)
@@ -571,11 +571,14 @@ void ContentsChatItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) {
       onClickable = true;
       showWebPreview(click);
     } else if(click.type == Clickable::Channel) {
-      // don't make clickable if it's our own name
       QString name = data(ChatLineModel::DisplayRole).toString().mid(click.start, click.length);
-      BufferId myId = data(MessageModel::BufferIdRole).value<BufferId>();
-      if(Client::networkModel()->bufferName(myId) != name)
-        onClickable = true;
+      // don't make clickable if it could be a #number
+      if(!QRegExp("^#\\d+$").exactMatch(name)) {
+      // don't make clickable if it's our own name
+        BufferId myId = data(MessageModel::BufferIdRole).value<BufferId>();
+        if(Client::networkModel()->bufferName(myId) != name)
+          onClickable = true;
+      }
     }
     if(onClickable) {
       setCursor(Qt::PointingHandCursor);