Created
September 21, 2013 10:51
-
-
Save torhve/6649444 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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