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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Eric L.-2
URL:
  <http://savannah.nongnu.org/bugs/?34318>

                 Summary: weechat.buffer_search should do/support a case
insensitive match
                 Project: WeeChat
            Submitted by: fixato
            Submitted on: Sat 17 Sep 2011 13:58:04 GMT
                Category: script API plugins
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name:
        Originator Email:
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 0.3.5
                IRC nick: FiXato

    _______________________________________________________

Details:

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).




    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?34318>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
Weechat-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-dev
Reply | Threaded
Open this post in threaded view
|

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

Eric L.-2
Update of bug #34318 (project weechat):

              Item Group:                    None => other                  
             Assigned to:                    None => flashcode              

    _______________________________________________________

Follow-up 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.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?34318>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.nongnu.org/


_______________________________________________
Weechat-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-dev
Reply | Threaded
Open this post in threaded view
|

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

Eric L.-2
Follow-up Comment #2, bug #34318 (project weechat):

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

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?34318>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
Weechat-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-dev
Reply | Threaded
Open this post in threaded view
|

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

Eric L.-2
Follow-up Comment #3, bug #34318 (project weechat):

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

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?34318>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
Weechat-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-dev
Reply | Threaded
Open this post in threaded view
|

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

Eric L.-2
Update of bug #34318 (project weechat):

                  Status:                    None => Ready For Test        
             Assigned to:               flashcode => nils_2                

    _______________________________________________________

Follow-up 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)
    _______________________________________________________

Additional Item Attachment:

File name: buffer_search_case_insensitive.patch Size:11 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?34318>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.nongnu.org/


_______________________________________________
Weechat-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-dev
Reply | Threaded
Open this post in threaded view
|

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

Eric L.-2
Update of bug #34318 (project weechat):

                  Status:          Ready For Test => Fixed                  

    _______________________________________________________

Follow-up 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 "==".

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?34318>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.nongnu.org/


_______________________________________________
Weechat-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-dev