Skip to content

Instantly share code, notes, and snippets.

@torhve
Created September 21, 2013 10:51
Show Gist options
  • Save torhve/6649444 to your computer and use it in GitHub Desktop.
Save torhve/6649444 to your computer and use it in GitHub Desktop.
function is_url_in_buffer(buffer, url)
lines = weechat.hdata_pointer(weechat.hdata_get('buffer'), buffer, 'own_lines')
line = weechat.hdata_pointer(weechat.hdata_get('lines'), lines, 'first_line')
hdata_line = weechat.hdata_get('line')
hdata_line_data = weechat.hdata_get('line_data')
while line do
data = weechat.hdata_pointer(hdata_line, line, 'data')
message = weechat.hdata_string(hdata_line_data, data, 'message')
if string.find(message, url) then
return true
end
line = weechat.hdata_move(hdata_line, line, 1)
w.print(buffer, 'line'..line)
end
return false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment