irc: add Disconnect in server actions; rename Connect->Open when session already active
Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
18
main.lua
18
main.lua
@@ -861,13 +861,29 @@ function IRC:getServerListItems()
|
||||
end
|
||||
|
||||
function IRC:getServerActions(server, index)
|
||||
local function isConnected()
|
||||
return self._bg_view and self._bg_view._sock and self._bg_view._server
|
||||
and self._bg_view._server.host == server.host
|
||||
and tostring(self._bg_view._server.port or 6667) == tostring(server.port or 6667)
|
||||
end
|
||||
local actions = {
|
||||
{
|
||||
text = _("Connect"),
|
||||
text_func = function()
|
||||
return isConnected() and _("Open") or _("Connect")
|
||||
end,
|
||||
callback = function()
|
||||
self:connectToServer(server)
|
||||
end,
|
||||
},
|
||||
{
|
||||
text = _("Disconnect"),
|
||||
enabled_func = function() return isConnected() end,
|
||||
callback = function()
|
||||
if self._bg_view and self._bg_view.disconnect then
|
||||
self._bg_view:disconnect()
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
text = _("Edit"),
|
||||
callback = function()
|
||||
|
||||
Reference in New Issue
Block a user