Skip to content
Snippets Groups Projects
Commit 0d5a9316 authored by Atanamo's avatar Atanamo
Browse files

Tooltips for game title of bots in user list and full datetime stamps

parent 43ffce08
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -119,6 +119,9 @@ class SchizoBot
getNickName: ->
return @nickName
 
getGameTitle: ->
return @gameData.title
getWebChannelList: ->
return @botChannelList
 
Loading
Loading
@@ -249,7 +252,7 @@ class SchizoBot
if targetNickOrChannel is @nick
log.debug "Notice by #{senderNick} to #{targetNickOrChannel}: #{notice}"
else if @_isChannelMaster(targetNickOrChannel)
@_sendToWebChannel(targetNickOrChannel, 'handleBotNotice', senderNick, notice)
@_sendNoticeToWebChannel(targetNickOrChannel, senderNick, notice)
 
 
_handleIrcCommandViaCTCP: (senderNick, targetNickOrChannel, rawMessage) =>
Loading
Loading
@@ -264,7 +267,7 @@ class SchizoBot
if checkMessage.indexOf('action') is 0
actionText = rawMessage.replace(/^(action)/i, '').trim() # Extract action text
noticeText = "#{senderNick} #{actionText}" # Build complete notice
@_sendToWebChannel(channel, 'handleBotNotice', senderNick, noticeText)
@_sendNoticeToWebChannel(channel, senderNick, noticeText)
 
_handleIrcCommandReplyViaCTCP: (senderNick, targetNickOrChannel, rawReplyMessage) =>
# This handler should only be triggered, if the bot had sent a CTCP request to another IRC client before
Loading
Loading
Loading
Loading
@@ -215,11 +215,22 @@ class BotChannel extends Channel
# @override
_getUserList: ->
userList = super
botGameNames = {}
# Get game titles of bots
for botID, bot of @botList
botGameNames[bot.getNickName()] = bot.getGameTitle()
 
# Append irc users to list
for nickName, userFlag of @ircUserList
clientIdentity = ClientIdentity.createFromIrcNick("#{userFlag}#{nickName}")
userList.push(clientIdentity.toData())
identityData = clientIdentity.toData()
if botGameNames[nickName]?
# Append game title to full name, if user is a bot
identityData.title += ' - ' + botGameNames[nickName]
userList.push(identityData)
 
return userList
 
Loading
Loading
Loading
Loading
@@ -152,7 +152,7 @@ class this.ChatController
 
handleChannelNotice: (channel, timestamp, data) ->
tabPage = @_getChannelTabPage(channel)
@_appendNoticeToTab(tabPage, timestamp, 'notice', data.text)
@_appendNoticeToTab(tabPage, timestamp, 'notice', data.text, true)
@_addNewEntryMarkToTab(tabPage, data, data.text)
 
handleChannelHistoryMark: (channel, timestamp, data) ->
Loading
Loading
@@ -340,11 +340,13 @@ class this.ChatController
@_appendEntryToTab(tabPage, timestamp, 'message', text, options)
@_scrollToBottomOfTab(tabPage)
 
_appendNoticeToTab: (tabPage, timestamp, noticeType, noticeText) ->
_appendNoticeToTab: (tabPage, timestamp, noticeType, noticeText, isSentByUser=false) ->
noticeText = "** #{noticeText}" unless tabPage is @ui.tabPageServer # Prefix notices except for server tab
timestamp = (new Date()).getTime() unless timestamp?
styleClasses = 'notice'
styleClasses += ' fromUser' if isSentByUser
 
@_appendEntryToTab(tabPage, timestamp, 'server', noticeText, styleClasses: 'notice')
@_appendEntryToTab(tabPage, timestamp, 'server', noticeText, styleClasses: styleClasses)
@_scrollToBottomOfTab(tabPage)
 
_appendHistoryMarkerToTab: (tabPage, timestamp, markerNoticeText) ->
Loading
Loading
@@ -353,18 +355,16 @@ class this.ChatController
@_scrollToBottomOfTab(tabPage)
 
_appendEntryToTab: (tabPage, entryTimestamp, entryType, entryText, options) ->
timeString = null
timeString = @_getLocalizedTime(entryTimestamp) if entryTimestamp?
# Build new list item
itemElem = $('<li/>')
itemElem.attr('data-item', entryType)
itemElem.addClass(options.styleClasses)
itemElem.addClass('historical') if entryType isnt 'marker' and tabPage.hasClass('receiving-history')
 
if timeString?
if entryTimestamp?
spanElem = $('<span/>').addClass('time')
spanElem.text("[#{timeString}]")
spanElem.text("[#{@_getLocalizedTime(entryTimestamp)}]")
spanElem.attr('title', @_getLocalizedDateTime(entryTimestamp))
itemElem.append(spanElem)
itemElem.append(' ')
 
Loading
Loading
@@ -379,7 +379,7 @@ class this.ChatController
spanElem.append(' ')
spanElem.append(inlineSpanElem)
 
itemElem.append(': ')
spanElem.append(': ')
 
spanElem = $('<span/>').addClass('content')
spanElem.text(entryText)
Loading
Loading
@@ -407,8 +407,8 @@ class this.ChatController
tabID = tabPage.attr('id')
isReceivingHistory = tabPage.hasClass('receiving-history')
 
# Ignore historical messages, accept those addressing the user explicitly
return if isReceivingHistory and not notifyData.isAddressingOwn
# Ignore historical messages
return if isReceivingHistory
 
# Mark tab for new message
if document.hidden or not @isInVisibleContext or tabID isnt @activeTabPage.attr('id')
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment