void owl_select_remove_dispatch_at(int elt) /* noproto */ { owl_list *dl; owl_dispatch *d; dl = owl_global_get_dispatchlist(&g); d = (owl_dispatch*)owl_list_get_element(dl, elt); owl_list_remove_element(dl, elt); if (d->destroy) { d->destroy(d); } }
/* remove an AIM buddy from the buddy list */ int owl_buddylist_remove_aim_buddy(owl_buddylist *bl, const char *name) { int i, j; owl_buddy *b; j=owl_list_get_size(&(bl->buddies)); for (i=0; i<j; i++) { b=owl_list_get_element(&(bl->buddies), i); if (!strcasecmp(name, owl_buddy_get_name(b)) && owl_buddy_is_proto_aim(b)) { owl_list_remove_element(&(bl->buddies), i); owl_buddy_delete(b); return(0); } } return(1); }
int owl_zbuddylist_deluser(owl_zbuddylist *zb, const char *name) { int i, j; char *user, *ptr; user=long_zuser(name); j=owl_list_get_size(&(zb->zusers)); for (i=0; i<j; i++) { ptr=owl_list_get_element(&(zb->zusers), i); if (!strcasecmp(user, ptr)) { owl_list_remove_element(&(zb->zusers), i); owl_free(ptr); owl_free(user); return(0); } } owl_free(user); return(-1); }
void owl_select_remove_io_dispatch(const owl_io_dispatch *in) { int elt; if (in != NULL) { elt = owl_select_find_io_dispatch(in); if (elt != -1) { owl_list *dl = owl_global_get_io_dispatch_list(&g); owl_io_dispatch *d = owl_list_get_element(dl, elt); if (dispatch_active) d->needs_gc = 1; else { owl_select_invalidate_io_dispatch(d); owl_list_remove_element(dl, elt); if (d->destroy) d->destroy(d); g_free(d); } } } }
/* removes the binding associated with the keymap */ int owl_keymap_remove_binding(owl_keymap *km, const char *keyseq) { owl_keybinding *kb, *curkb; int i; kb = owl_keybinding_new(keyseq, NULL, NULL, NULL); if (kb == NULL) return -1; for (i = owl_list_get_size(&km->bindings)-1; i >= 0; i--) { curkb = owl_list_get_element(&km->bindings, i); if (owl_keybinding_equal(curkb, kb)) { owl_list_remove_element(&km->bindings, i); owl_keybinding_delete(curkb); owl_keybinding_delete(kb); return(0); } } owl_keybinding_delete(kb); return(-2); }
/* creates and adds a key binding */ int owl_keymap_create_binding(owl_keymap *km, const char *keyseq, const char *command, void (*function_fn)(void), const char *desc) { owl_keybinding *kb, *curkb; int i; kb = owl_keybinding_new(keyseq, command, function_fn, desc); if (kb == NULL) return -1; /* see if another matching binding, and if so remove it. * otherwise just add this one. */ for (i = owl_list_get_size(&km->bindings)-1; i>=0; i--) { curkb = owl_list_get_element(&km->bindings, i); if (owl_keybinding_equal(curkb, kb)) { owl_list_remove_element(&km->bindings, i); owl_keybinding_delete(curkb); } } return owl_list_append_element(&km->bindings, kb); }