X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Ffile_ops.c;h=d1b529d57efada1399545722745c3873bdf07e5c;hb=9caef44a2f42ab81b2489ae19859f1bbc25d4430;hp=3bb6da1d8fc9962ec5048c94a334e0fd3d66c472;hpb=e26a8dee20d1726b4995821f717f867f50fc5659;p=citadel.git diff --git a/citadel/file_ops.c b/citadel/file_ops.c index 3bb6da1d8..d1b529d57 100644 --- a/citadel/file_ops.c +++ b/citadel/file_ops.c @@ -45,72 +45,6 @@ #include "ctdl_module.h" #include "user_ops.h" -/* - * network_talking_to() -- concurrency checker - */ -static char *nttlist = NULL; -int network_talking_to(char *nodename, int operation) { - - char *ptr = NULL; - int i; - char buf[SIZ]; - int retval = 0; - - begin_critical_section(S_NTTLIST); - - switch(operation) { - - case NTT_ADD: - if (nttlist == NULL) nttlist = strdup(""); - if (nttlist == NULL) break; - nttlist = (char *)realloc(nttlist, - (strlen(nttlist) + strlen(nodename) + 3) ); - strcat(nttlist, "|"); - strcat(nttlist, nodename); - break; - - case NTT_REMOVE: - if (nttlist == NULL) break; - if (IsEmptyStr(nttlist)) break; - ptr = malloc(strlen(nttlist)); - if (ptr == NULL) break; - strcpy(ptr, ""); - for (i = 0; i < num_tokens(nttlist, '|'); ++i) { - extract_token(buf, nttlist, i, '|', sizeof buf); - if ( (!IsEmptyStr(buf)) - && (strcasecmp(buf, nodename)) ) { - strcat(ptr, buf); - strcat(ptr, "|"); - } - } - free(nttlist); - nttlist = ptr; - break; - - case NTT_CHECK: - if (nttlist == NULL) break; - if (IsEmptyStr(nttlist)) break; - for (i = 0; i < num_tokens(nttlist, '|'); ++i) { - extract_token(buf, nttlist, i, '|', sizeof buf); - if (!strcasecmp(buf, nodename)) ++retval; - } - break; - } - - if (nttlist != NULL) syslog(LOG_DEBUG, "nttlist=<%s>\n", nttlist); - end_critical_section(S_NTTLIST); - return(retval); -} - -void cleanup_nttlist(void) -{ - begin_critical_section(S_NTTLIST); - if (nttlist != NULL) - free(nttlist); - nttlist = NULL; - end_critical_section(S_NTTLIST); -} - /* @@ -169,7 +103,6 @@ void cmd_movf(char *cmdbuf) char buf[PATH_MAX]; int a; struct ctdlroom qrbuf; - int rv = 0; extract_token(filename, cmdbuf, 0, '|', sizeof filename); extract_token(newroom, cmdbuf, 1, '|', sizeof newroom); @@ -223,7 +156,7 @@ void cmd_movf(char *cmdbuf) snprintf(buf, sizeof buf, "cat ./files/%s/filedir |grep \"%s\" >>./files/%s/filedir", CC->room.QRdirname, filename, qrbuf.QRdirname); - rv = system(buf); + system(buf); cprintf("%d File '%s' has been moved.\n", CIT_OK, filename); } @@ -703,9 +636,7 @@ void cmd_writ(char *cmdbuf) } if (bytes > 100000) { - cprintf("%d You may not write more than 100000 bytes.\n", - ERROR + TOO_BIG); - return; + bytes = 100000; } cprintf("%d %d\n", SEND_BINARY, bytes); @@ -827,6 +758,7 @@ void cmd_nuop(char *cmdbuf) CTDL_MODULE_INIT(file_ops) { if (!threading) { + CtdlRegisterProtoHook(cmd_delf, "DELF", "Delete a file"); CtdlRegisterProtoHook(cmd_movf, "MOVF", "Move a file"); CtdlRegisterProtoHook(cmd_open, "OPEN", "Open a download file transfer"); @@ -839,7 +771,6 @@ CTDL_MODULE_INIT(file_ops) CtdlRegisterProtoHook(cmd_nuop, "NUOP", "Open a network spool file for upload"); CtdlRegisterProtoHook(cmd_oimg, "OIMG", "Open an image file for download"); CtdlRegisterProtoHook(cmd_uimg, "UIMG", "Upload an image file"); - CtdlRegisterCleanupHook(cleanup_nttlist); } /* return our Subversion id for the Log */ return "file_ops";