[asterisk-commits] dlee: branch dlee/ASTERISK-22451-ari-subscribe r400011 - /team/dlee/ASTERISK-...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Sep 27 15:18:47 CDT 2013
Author: dlee
Date: Fri Sep 27 15:18:46 2013
New Revision: 400011
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=400011
Log:
Found the template.
Modified:
team/dlee/ASTERISK-22451-ari-subscribe/main/endpoints.c
Modified: team/dlee/ASTERISK-22451-ari-subscribe/main/endpoints.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22451-ari-subscribe/main/endpoints.c?view=diff&rev=400011&r1=400010&r2=400011
==============================================================================
--- team/dlee/ASTERISK-22451-ari-subscribe/main/endpoints.c (original)
+++ team/dlee/ASTERISK-22451-ari-subscribe/main/endpoints.c Fri Sep 27 15:18:46 2013
@@ -94,13 +94,29 @@
{
const struct ast_endpoint *left = obj;
const struct ast_endpoint *right = arg;
- const char *right_id = (flags & OBJ_KEY) ? arg : right->id;
-
- if (strcmp(left->id, right_id) == 0) {
- return CMP_MATCH;
- }
-
- return 0;
+ const char *right_key = arg;
+ int cmp;
+
+ switch (flags & OBJ_SEARCH_MASK) {
+ case OBJ_SEARCH_OBJECT:
+ right_key = right->username;
+ /* Fall through */
+ case OBJ_SEARCH_KEY:
+ cmp = strcmp(left->username, right_key);
+ break;
+ case OBJ_SEARCH_PARTIAL_KEY:
+ cmp = strncmp(left->username, right_key, strlen(right_key));
+ break;
+ default:
+ ast_assert(0);
+ cmp = 0;
+ break;
+ }
+ if (cmp) {
+ return 0;
+ }
+
+ return CMP_MATCH;
}
struct ast_endpoint *ast_endpoint_find_by_id(const char *id)
More information about the asterisk-commits
mailing list