[asterisk-dev] [Code Review] Fix a problem with channel name tab completion
Russell Bryant
russell at digium.com
Tue Aug 10 11:08:56 CDT 2010
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/818/
-----------------------------------------------------------
(Updated 2010-08-10 11:08:56.491720)
Review request for Asterisk Developers.
Changes
-------
After talking to David Vossel, he proposed a painfully simple alternative to the patch I had originally written. It's just a few lines. Thanks, David. :-)
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 (updated)
-----
/branches/1.8/main/cli.c 281528
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