62
62
# The file where the command output (if any) is saved. Overwritten
63
63
# each time you launch a new URL. Default is ~/.weechat/urllaunch.log
64
64
#
65
+ # use_full_name
66
+ # Whether or not to use the buffer's full name to store the URL. This can
67
+ # help if you have such issues as URLs getting saved under buffers that
68
+ # have a typing indicator active, or you have the same channel name in
69
+ # two different networks.
70
+ #
65
71
# default
66
72
# The command that will be run if no arguemnts to /url are given.
67
73
# Default is show
68
74
#
69
75
# Requirements:
70
76
#
71
77
# - Designed to run with weechat version 0.3 or better.
72
- # http ://www. weechat.org/
78
+ # https ://weechat.org/
73
79
#
74
80
# Acknowlegements:
75
81
#
125
131
# - Updated script for python3 support (now python2 and 3 are both supported)
126
132
# - V3.0 Sébastien Helleu <[email protected] >:
127
133
# - Fix python 3 compatibility (replace "has_key" by "in")
134
+ # - V3.1 Ron Alleva <[email protected] >:
135
+ # - Add 'use_full_name' setting, to allow storing URLs by full name of buffer
128
136
#
129
137
# Copyright (C) 2005 David Rubin <drubin AT smartcube dot co dot za>
130
138
#
152
160
import_ok = True
153
161
except :
154
162
print ("This script must be run under WeeChat." )
155
- print ("Get WeeChat now at: http ://www. weechat.org/ " )
163
+ print ("Get WeeChat now at: https ://weechat.org" )
156
164
import_ok = False
157
165
import subprocess
158
166
import time
177
185
178
186
SCRIPT_NAME = "urlgrab"
179
187
SCRIPT_AUTHOR = "David Rubin <drubin [At] smartcube [dot] co [dot] za>"
180
- SCRIPT_VERSION = "3.0 "
188
+ SCRIPT_VERSION = "3.1 "
181
189
SCRIPT_LICENSE = "GPL"
182
190
SCRIPT_DESC = "Url functionality Loggin, opening of browser, selectable links"
183
191
CONFIG_FILE_NAME = "urlgrab"
@@ -203,7 +211,9 @@ def urlGrabPrint(message):
203
211
weechat .prnt (bufferd ,"[%s] %s" % ( SCRIPT_NAME , message ) )
204
212
205
213
def hashBufferName (bufferp ):
206
- if not weechat .buffer_get_string (bufferp , "short_name" ):
214
+ if (urlGrabSettings ['use_full_name' ]):
215
+ bufferd = weechat .buffer_get_string (bufferp , "full_name" )
216
+ elif not weechat .buffer_get_string (bufferp , "short_name" ):
207
217
bufferd = weechat .buffer_get_string (bufferp , "name" )
208
218
else :
209
219
bufferd = weechat .buffer_get_string (bufferp , "short_name" )
@@ -298,6 +308,13 @@ def __init__(self):
298
308
"remotecmd" , "string" , remotecmd , "" , 0 , 0 ,
299
309
remotecmd , remotecmd , 0 , "" , "" , "" , "" , "" , "" )
300
310
311
+ self .data ['use_full_name' ]= weechat .config_new_option (
312
+ self .config_file , section_default ,
313
+ "use_full_name" , "boolean" ,
314
+ """Use full name of buffer to store URL""" , "" , 0 , 0 ,
315
+ "0" , "0" , 0 , "" , "" , "" , "" , "" , ""
316
+ )
317
+
301
318
self .data ['url_log' ]= weechat .config_new_option (
302
319
self .config_file , section_default ,
303
320
"url_log" , "string" , """log location""" , "" , 0 , 0 ,
@@ -320,6 +337,8 @@ def __getitem__(self, key):
320
337
return weechat .config_integer (self .data [key ])
321
338
elif key == 'output_main_buffer' :
322
339
return weechat .config_boolean (self .data [key ])
340
+ elif key == 'use_full_name' :
341
+ return weechat .config_boolean (self .data [key ])
323
342
#elif key.startswith('color'):
324
343
# return weechat.config_color(self.data[key])
325
344
else :
@@ -664,7 +683,7 @@ def completion_urls_cb(data, completion_item, bufferp, completion):
664
683
bufferd = hashBufferName ( bufferp )
665
684
for url in urlGrab .globalUrls :
666
685
if url ['buffer' ] == bufferd :
667
- weechat .hook_completion_list_add (completion , url ['url' ], 0 , weechat .WEECHAT_LIST_POS_SORT )
686
+ weechat .completion_list_add (completion , url ['url' ], 0 , weechat .WEECHAT_LIST_POS_SORT )
668
687
return weechat .WEECHAT_RC_OK
669
688
670
689
def ug_unload_script ():
0 commit comments