X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Ffile_ops.c;h=d1b529d57efada1399545722745c3873bdf07e5c;hb=9caef44a2f42ab81b2489ae19859f1bbc25d4430;hp=9040c4c746b4d009ba5cad19ebc91644be48c1b3;hpb=da1debddf5988512ac50ff0b62ac85c8f3b8d0f4;p=citadel.git diff --git a/citadel/file_ops.c b/citadel/file_ops.c index 9040c4c74..d1b529d57 100644 --- a/citadel/file_ops.c +++ b/citadel/file_ops.c @@ -45,60 +45,6 @@ #include "ctdl_module.h" #include "user_ops.h" -/* - * network_talking_to() -- concurrency checker - */ -static HashList *nttlist = NULL; -int network_talking_to(const char *nodename, long len, int operation) { - - int retval = 0; - HashPos *Pos = NULL; - void *vdata; - - begin_critical_section(S_NTTLIST); - - switch(operation) { - - case NTT_ADD: - if (nttlist == NULL) - nttlist = NewHash(1, NULL); - Put(nttlist, nodename, len, NewStrBufPlain(nodename, len), HFreeStrBuf); - syslog(LOG_DEBUG, "nttlist: added <%s>\n", nodename); - break; - case NTT_REMOVE: - if ((nttlist == NULL) || - (GetCount(nttlist) == 0)) - break; - Pos = GetNewHashPos(nttlist, 1); - GetHashPosFromKey (nttlist, nodename, len, Pos); - - DeleteEntryFromHash(nttlist, Pos); - DeleteHashPos(&Pos); - syslog(LOG_DEBUG, "nttlist: removed <%s>\n", nodename); - - break; - - case NTT_CHECK: - if ((nttlist == NULL) || - (GetCount(nttlist) == 0)) - break; - if (!GetHash(nttlist, nodename, len, &vdata)) - retval ++; - syslog(LOG_DEBUG, "nttlist: have [%d] <%s>\n", retval, nodename); - break; - } - - end_critical_section(S_NTTLIST); - return(retval); -} - -void cleanup_nttlist(void) -{ - begin_critical_section(S_NTTLIST); - DeleteHash(&nttlist); - end_critical_section(S_NTTLIST); -} - /* @@ -157,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); @@ -211,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); } @@ -691,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); @@ -815,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"); @@ -827,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";