bugWeeChat - Bugs: bug #34318, weechat.buffer_search should...

 
 

bug #34318: weechat.buffer_search should do/support a case insensitive match

Submitter:  Filip H.F. "FiXato" Slagter <fixato>
Submitted:  Sat 17 Sep 2011 01:58:04 PM UTC
   
 
Category:  script API plugins Severity:  3 - Normal
Item Group:  other Status:  Fixed
Privacy:  Public Assigned to:  nils_2
Originator Name:  Open/Closed:  Closed
Release:  * 0.3.5 IRC nick:  FiXato
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 11 Mar 2014 02:34:13 PM UTC, comment #5: 

Fixed with a similar patch: the "(?i)" can be used for case insensitive search, but the function "buffer_search_by_full_name" has not been added in API: instead, the function buffer_search can be used with plugin set to "==".

Sebastien Helleu <flashcode>
Group administrator
Mon 01 Apr 2013 08:35:25 PM UTC, comment #4: 

patch for a case insensitive buffer_search. To enable a case insensitive
search, you have to use prefix "(?i)" in front of "name" argument.

Example (python):
weechat.prnt("",'ptr_buffer: %s' % weechat.buffer_search('irc','(?i)freenode.#photography'))



This patch also includes a new API function called "weechat_buffer_search_by_full_name"

Prototype:
struct t_gui_buffer *weechat_buffer_search_by_full_name (const char *full_name);

Arguments:

    full_name: full name of buffer ("plugin.name")

Allowed prefix:
    (?i) : for case insensitive search

Return value:

    pointer to buffer found, NULL if not found

C example:

struct t_gui_buffer *my_buffer = weechat_buffer_search_by_full_name ("my_buffer");


Script (Python):

# prototype
buffer = weechat.buffer_search_by_full_name(full_name)

# example
buffer = weechat.buffer_search_by_full_name("irc.freenode.#weechat")
buffer = weechat.buffer_search_by_full_name("(?i)irc.freenode.#WeEcHaT")


(file #27739)

Nils G <nils_2>
Group Member
Thu 01 Nov 2012 02:12:39 AM UTC, comment #3: 

The info_get solution seems fine if your problem is only with channel case sensitivity, but I need a case sensitive lookup for both channel and server.

Both info_get and buffer_search are case sensitive for server names. Is there a way you can get a list of all servers and channels (buffers?) and search through them yourself?

Troy

Troy <mrhazard>
Sat 17 Sep 2011 07:31:00 PM UTC, comment #2: 

That indeed works :)
I would suggest at least adding a note at buffer_search suggesting to use info_get for IRC buffers.

Filip H.F. "FiXato" Slagter <fixato>
Sat 17 Sep 2011 06:16:57 PM UTC, comment #1: 

If you're looking for an irc channel (and that you know internal name of server), you can do that (example in python):

buffer = weechat.info_get('irc_buffer', 'freenode,#weechat')

(this is case insensitive for both server and channel name)

It's only a workaround for irc buffers only, I can still add case insensitive search for buffers.

Sebastien Helleu <flashcode>
Group administrator
Sat 17 Sep 2011 01:58:04 PM UTC, original submission:  

Say I've opened an (IRC) buffer called #photography (note: all lowercase).
Then, when someone does a /join #Photography, some IRC servers (Bahamut and UnrealIRCd for instance) will report the channel name as #Photography (with a capital P).

In this case weechat.buffer_search will not be able to find the buffer, since the cases don't match.
I would suggest having weechat.buffer_search do a case insensitive match (or allowing an argument to enable it).

Filip H.F. "FiXato" Slagter <fixato>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by nils_2 (Updated the item)
  • -email is unavailable- added by mrhazard (Posted a comment)
  • -email is unavailable- added by flashcode (Posted a comment)
  • -email is unavailable- added by fixato (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-08-15 flashcode Open/ClosedOpen Closed
    2014-03-11 flashcode StatusReady For Test Fixed
    2013-04-01 nils_2 Attached File- Added buffer_search_case_insensitive.patch, #27739
        StatusNone Ready For Test
        Assigned toflashcode nils_2
    2011-09-17 flashcode Assigned toNone flashcode
    2011-09-17 flashcode Item GroupNone other

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code