int urltrans_add_one(URLTranslationList *trans, CfgGroup *grp) { URLTranslation *ot; long i; List *list, *list2; Octstr *alias; ot = create_onetrans(grp); if (ot == NULL) return -1; list_append(trans->list, ot); list2 = dict_get(trans->names, ot->name); if (list2 == NULL) { list2 = list_create(); dict_put(trans->names, ot->name, list2); } list_append(list2, ot); if (ot->keyword == NULL || ot->type == TRANSTYPE_SENDSMS) return 0; list = dict_get(trans->dict, ot->keyword); if (list == NULL) { list = list_create(); dict_put(trans->dict, ot->keyword, list); } list_append(list, ot); for (i = 0; i < list_len(ot->aliases); ++i) { alias = list_get(ot->aliases, i); list = dict_get(trans->dict, alias); if (list == NULL) { list = list_create(); dict_put(trans->dict, alias, list); } list_append(list, ot); } return 0; }
int urltrans_add_one(URLTranslationList *trans, CfgGroup *grp) { URLTranslation *ot; List *list2; ot = create_onetrans(grp); if (ot == NULL) return -1; if (ot->type != TRANSTYPE_SENDSMS && ot->keyword_regex == NULL) gwlist_append(trans->defaults, ot); else gwlist_append(trans->list, ot); list2 = dict_get(trans->names, ot->name); if (list2 == NULL) { list2 = gwlist_create(); dict_put(trans->names, ot->name, list2); } gwlist_append(list2, ot); return 0; }