Browse Source

add OTRMeise lua script for weechat

master
Markus Bergholz 2 years ago
parent
commit
b8ee4cab3d
1 changed files with 50 additions and 0 deletions
  1. 50
    0
      weechat/lua/dorfling.lua

+ 50
- 0
weechat/lua/dorfling.lua View File

@@ -0,0 +1,50 @@
--
-- <user> has quit (Leaving...)
-- otr disconnect in buffer "&bitlbee

-- <user> has joined &bitlbee
-- otr reconnect in buffer "&bitlbee

-- init
local w = weechat

-- todo: read variablelist from weechat buffer
local user1 = "exampleuser"


-- weechat.register(Name, Author, Version, Lizenz, Beschreibung, Shutdown_Funktion, Zeichensatz)
w.register("OTRMeise", "markus", "17.0", "WTFPL", "OTR Hooks für user mit lausigen xmpp client", "", "")
w.print("", "OTRMeise passt jetzt auf!")

-- perform otr disconnect user1
function otr_disconnect (data, signal, signal_data)
local nick = w.info_get("irc_nick_from_host", signal_data)
if (nick == user1) then
local buffer = w.info_get("irc_buffer", "osuv,&bitlbee")
w.command(buffer, "otr disconnect " .. user1)
w.print("", "OTRMeise: otr disconnect " .. user1)
elseif (nick == user2) then
local buffer = w.info_get("irc_buffer", "osuv,&bitlbee")
w.command(buffer, "otr disconnect " .. user2)
w.print("", "OTRMeise: otr disconnect " .. user2)
end
return w.WEECHAT_RC_OK
end -- otr_disconnect

-- perform otr reconnect user
function otr_reconnect (data, signal, signal_data)
local nick = w.info_get("irc_nick_from_host", signal_data)
if (nick == user1) then
local buffer = w.info_get("irc_buffer", "osuv,&bitlbee")
w.command(buffer, "otr connect " .. user1)
w.print("", "OTRMeise: otr connect " .. user1)
elseif (nick == user2) then
local buffer = w.info_get("irc_buffer", "osuv,&bitlbee")
w.command("", "OTRMeise: otr connect " .. user2)
w.print("", "OTRMeise: otr connect " .. user2)
end
return w.WEECHAT_RC_OK
end -- otr_disconnect

w.hook_signal("*,irc_in2_quit", "otr_disconnect", "")
w.hook_signal("*,irc_in2_join", "otr_reconnect", "")

Loading…
Cancel
Save