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

 
 

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

Submitted by:  Filip H.F. "FiXato" Slagter <fixato>
Submitted on:  Sat 17 Sep 2011 01:58:04 PM UTC  
 
Category: script API pluginsSeverity: 3 - Normal
Item Group: otherStatus: Fixed
Privacy: PublicAssigned to: Nils G <nils_2>
Originator Name: Open/Closed: Open
Release: 0.3.5IRC nick: FiXato

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project 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>
Project MemberIn charge of this item.
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>
Project 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 File(s):
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 11 Mar 2014 02:34:13 PM UTCflashcodeStatusReady For Test=>Fixed
    Mon 01 Apr 2013 08:35:25 PM UTCnils_2Attached File-=>Added buffer_search_case_insensitive.patch, #27739
      StatusNone=>Ready For Test
      Assigned toflashcode=>nils_2
    Sat 17 Sep 2011 06:16:57 PM UTCflashcodeAssigned toNone=>flashcode
    Sat 17 Sep 2011 06:16:56 PM UTCflashcodeItem GroupNone=>other

    Back to the top


    Powered by Savane 3.1-cleanup