void AddServerConf(char *address, int port, char *password) { struct servercstruct *slist, *stmp; stmp=malloc(sizeof(struct servercstruct)); LinkToList(stmp,slist,serverclist); slist->address=strdup(address); if(password!=NULL) slist->password=strdup(password); slist->port=port; slist->sinfo=GetNewSocket(server_action); SetIrcProtocol(slist->sinfo); slist->nexttry=0; if (slist->sinfo!=NULL) return; UnlinkListItem(slist,serverclist); free(slist->address); free(slist->password); free(slist); }
struct commandlist *delcommandmodule(void *module, struct commandlist *list) { struct commandlist *listptr; listptr = list; while (listptr != NULL) { if (listptr->module == module) { UnlinkListItem(listptr, list); free(listptr->cmd) ; free(listptr) ; } listptr = listptr->next; } return (list); }
struct commandlist *delcommand(void *module, struct commandlist *list, const char *command) { struct commandlist *listptr; listptr = list; while (listptr != NULL) { if (listptr->module == module && strcaseeq(command, listptr->cmd)) { UnlinkListItem(listptr, list); free(listptr->cmd) ; free(listptr) ; break; } listptr = listptr->next; } return (list); }
static void ReapConfServers() { struct servercstruct *slist, *tnext; slist=serverclist; while(slist!=NULL) { tnext=slist->next; if(slist->reap) { UnlinkListItem(slist,serverclist); FreeSocket(slist->sinfo); free(slist->address); free(slist->password); free(slist); } slist=tnext; } }
int delete_channel(const char *name) { struct channels *channel_curr; channel_curr = conf_channels; while (channel_curr != NULL) { if (strcaseeq(channel_curr->name, name)) { break; } channel_curr = channel_curr->next; } if (channel_curr == NULL) return (-1); UnlinkListItem(channel_curr, conf_channels); free(channel_curr); return (0); }