[asterisk-dev] [Code Review] Fix a problem with channel name tab completion

Russell Bryant russell at digium.com
Tue Aug 3 15:42:08 CDT 2010



> On 2010-08-03 15:07:28, David Vossel wrote:
> > /branches/1.8/main/channel.c, lines 1566-1578
> > <https://reviewboard.asterisk.org/r/818/diff/1/?file=11971#file11971line1566>
> >
> >     Why can't we just use ao2_find if the name is not zero length, and an ao2_callback function that matches everything if the name is zero length?

I guess that would work, too.  However, that makes the empty name length (or empty extension) case a special case.  In this code, it's not a special case and is handled by the same single matching function.


- Russell


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/818/#review2526
-----------------------------------------------------------


On 2010-07-29 11:29:04, Russell Bryant wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/818/
> -----------------------------------------------------------
> 
> (Updated 2010-07-29 11:29:04)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> It was reported to me internally that there was a problem with channel name tab completion in Asterisk 1.8.  As I looked further, it worked fine as long as you typed part of the channel name.  It failed to provide any suggested results when hitting tab starting from a blank channel name.
> 
> I traced the regression down to the way that channel iterators with parameters work.  In this case, an iterator by name was created with a blank name.  In this case, the iterator treated no channels as a match.  This patch changes behavior such that if an iterator by name is created with a blank name, it treats all channels as a match.  This patch also applies the same change in behavior to the other iterator types.  For example, if an iterator by extension is created with a blank extension string, all channels will now match.
> 
> This patch is a case where it looks like it's changing more than it really is.  The key difference in the code is that previously, the channel comparison function used the fact that a string was non-empty to know which criteria it was to use for comparing the channels.  Now, an additional value is passed in (an enum) that identifies which type of comparison should be done.  This had to be done since there are cases where the string will be empty on purpose, such as the channel tab completion case.
> 
> 
> Diffs
> -----
> 
>   /branches/1.8/main/channel.c 280225 
> 
> Diff: https://reviewboard.asterisk.org/r/818/diff
> 
> 
> Testing
> -------
> 
> Verified that channel name tab completion now works as expected using the "channel request hangup <tab>" command.
> 
> 
> Thanks,
> 
> Russell
> 
>




More information about the asterisk-dev mailing list