function processMessageMenu(mousePos, mouseButton, creatureName, text, label, tab)
if mouseButton == MouseRightButton then
local menu = g_ui.createWidget('PopupMenu')
menu:setGameMenu(true)
if creatureName and #creatureName > 0 then
if creatureName ~= g_game.getCharacterName() then
menu:addOption(tr('Message to ' .. creatureName), function() g_game.openPrivateChannel(creatureName) end)
if not g_game.getLocalPlayer():hasVip(creatureName) then
menu:addOption(tr('Add to VIP list'), function() g_game.addVip(creatureName) end)
end
if modules.game_console.getOwnPrivateTab() then
menu:addSeparator()
menu:addOption(tr('Invite to private chat'), function() g_game.inviteToOwnChannel(creatureName) end)
menu:addOption(tr('Exclude from private chat'), function() g_game.excludeFromOwnChannel(creatureName) end)
end
if isIgnored(creatureName) then
menu:addOption(tr('Unignore') .. ' ' .. creatureName, function() removeIgnoredPlayer(creatureName) end)
else
menu:addOption(tr('Ignore') .. ' ' .. creatureName, function() addIgnoredPlayer(creatureName) end)
end
menu:addSeparator()
end
if modules.game_ruleviolation.hasWindowAccess() then
menu:addOption(tr('Rule Violation'), function() modules.game_ruleviolation.show(creatureName, text:match('.+%:%s(.+)')) end)
menu:addSeparator()
end
menu:addOption(tr('Copy name'), function() g_window.setClipboardText(creatureName) end)
end
local selection = tab.tabPanel:getChildById('consoleBuffer').selectionText
if selection and #selection > 0 then
menu:addOption(tr('Copy'), function() g_window.setClipboardText(selection) end, '(Ctrl+C)')
end
if text then
menu:addOption(tr('Copy message'), function() g_window.setClipboardText(text) end)
end
menu:addOption(tr('Select all'), function() selectAll(tab.tabPanel:getChildById('consoleBuffer')) end)
if tab.violations and creatureName then
menu:addSeparator()
menu:addOption(tr('Process') .. ' ' .. creatureName, function() processViolation(creatureName, text) end)
menu:addOption(tr('Remove') .. ' ' .. creatureName, function() g_game.closeRuleViolation(creatureName) end)
end
menu:display(mousePos)
end
end