--- Configure.orig Sun Feb 22 17:36:16 2004 +++ Configure Mon Mar 29 22:31:59 2004 @@ -18,9 +18,9 @@ fi if [ $RELEASE -eq 1 ]; then - VERSIONLONG="$VERSION [$CSET]" + VERSIONLONG="$VERSION [$CSET] mod by Splizzer v1.6" else - VERSIONLONG="$VERSION [PRERELEASE $CSET]" + VERSIONLONG="$VERSION [PRERELEASE $CSET] mod by Splizzer v1.6" fi echo --- src/iroffer_admin.c.orig Sun Feb 22 17:36:16 2004 +++ src/iroffer_admin.c Mon Mar 29 22:27:21 2004 @@ -25,6 +25,8 @@ static void u_help(const userinput * const u); static void u_xdl(const userinput * const u); +static void u_xdlfull(const userinput * const u); //Splizzer +static void u_xdlgroup(const userinput * const u); //Splizzer static void u_xds(const userinput * const u); static void u_dcl(const userinput * const u); static void u_dcld(const userinput * const u); @@ -48,6 +50,10 @@ static void u_status(const userinput * const u); static void u_chfile(const userinput * const u); static void u_chdesc(const userinput * const u); +static void u_grouplist(void); //Splizzer +static void u_groupdesc(const userinput * const u); //Splizzer +static void u_group(const userinput * const u); //Splizzer +static void u_regroup(const userinput * const u); //Splizzer static void u_chnote(const userinput * const u); static void u_chmins(const userinput * const u); static void u_chmaxs(const userinput * const u); @@ -98,6 +104,8 @@ static const userinput_parse_t userinput_parse[] = { {1,method_allow_all,u_help, "HELP",NULL,"Shows Help"}, {1,method_allow_all_xdl,u_xdl, "XDL",NULL,"Lists Offered Files"}, +{1,method_allow_all_xdl,u_xdlfull, "XDLFULL",NULL,"Lists Offered Files"}, +{1,method_allow_all_xdl,u_xdlgroup, "XDLGROUP","","Show "}, {1,method_allow_all,u_xds, "XDS",NULL,"Save XDCC File"}, {1,method_allow_all,u_dcl, "DCL",NULL,"Lists Current Transfers"}, {1,method_allow_all,u_dcld, "DCLD",NULL,"Lists Current Transfers with Details"}, @@ -124,6 +132,9 @@ {3,method_allow_all,u_adddir, "ADDDIR","","Add Every File in "}, {3,method_allow_all,u_chfile, "CHFILE","n ","Change File of pack n to "}, {3,method_allow_all,u_chdesc, "CHDESC","n ","Change Description of pack n to "}, +{3,method_allow_all,u_groupdesc, "GROUPDESC","group ","Change Desc of group to "}, //Splizzer +{3,method_allow_all,u_group, "GROUP","n ","Change Group of pack n to "}, //Splizzer +{3,method_allow_all,u_regroup, "REGROUP","OLDGROUP NEWGROUP","Change Group of pack OLDGROUP to NEWGROUP"}, //Splizzer {3,method_allow_all,u_chnote, "CHNOTE","n ","Change Note of pack n to "}, {3,method_allow_all,u_chmins, "CHMINS","n x","Change min speed of pack n to x KB"}, {3,method_allow_all,u_chmaxs, "CHMAXS","n x","Change max speed of pack n to x KB"}, @@ -183,6 +194,17 @@ u->arg2 = getpart(line,3); u->arg3 = getpart(line,4); + + if (u->arg1==NULL) { + u->myparm = NULL; + } + + if (u->cmd!=NULL) { + if (!strcmp(u->cmd,"XDL")) u->myparm = NULL; + } + + + if (u->arg1) { u->arg1e = mycalloc(strlen(line) - strlen(u->cmd) - 1 + 1); @@ -225,6 +247,17 @@ u->arg2 = getpart(line,3); u->arg3 = getpart(line,4); + + if (u->arg1==NULL) { + u->myparm = NULL; + } + + if (u->cmd!=NULL) { + if (!strcmp(u->cmd,"XDL")) u->myparm = NULL; + } + + + if (u->arg1) { u->arg1e = mycalloc(strlen(line) - strlen(u->cmd) - 1 + 1); @@ -277,6 +310,11 @@ u->arg2 = getpart(line,8); u->arg3 = getpart(line,9); + if (u->cmd!=NULL) { + if (!strcmp(u->cmd,"XDL")) u->myparm = NULL; + } + + len = strlen(t1) + strlen(t2) + strlen(t3) + strlen(t4) + strlen(t5) + 5; if (u->arg1) @@ -472,9 +510,22 @@ int a,i,m,m1,s; float toffered; int len; + + int z=1; // Splizzer + + + int mycmdok; + + xdcc *xd; + grouplist *gl; + updatecontext(); + + mycmdok = 3; + + tempstr = mycalloc(maxtextlength); @@ -569,10 +620,27 @@ } u_respond(u,"%s",tempstr); - - u_respond(u,"\2**\2 To request a file type: \"/msg %s xdcc send #x\" \2**\2", - (gdata.user_nick ? gdata.user_nick : "??")); - } + + + //Splizzer Start + if (u->myparm == NULL) { + + } else { + xd = irlist_get_head(&gdata.xdccs); + + while(xd) { + + if (!strcmp(xd->group,u->myparm)) { mycmdok = 1; } + xd = irlist_get_next(xd); + } + } + //Splizzer End + + if (mycmdok == 1) {////////////// + u_respond(u,"\2**\2 To request a file type: \"/msg %s xdcc send #x\" \2**\2",gdata.user_nick); + } + else if (mycmdok == 3) u_respond(u,"\2**\2 For a listing type: \"/msg %s xdcc list group\" \2**\2",gdata.user_nick); + } if (m1) { @@ -605,6 +673,7 @@ i = 1; toffered = 0; + gl = irlist_get_head(&gdata.grouplists); xd = irlist_get_head(&gdata.xdccs); while(xd) { @@ -637,7 +706,33 @@ len = strlen(tempstr); } - u_respond(u,"%s",tempstr); + // Start Splizzer + + + if (mycmdok == 3) { + z=1; + + + /////////////////////////////// + + + + if (gl) { + u_respond(u,"group: %s %s",gl->group,gl->desc); + } + + + + ///////////////////////////////// + + } + if (u->myparm != NULL) { + if (!strcmp(xd->group,u->myparm) && mycmdok == 1){ // XDCC LIST //Splizzer + u_respond(u,"%s",tempstr); + } + } + + // End Splizzer if (xd->note && strlen(xd->note)) { @@ -652,6 +747,7 @@ i++; xd = irlist_get_next(xd); + if (gl) gl = irlist_get_next(gl); } if (gdata.creditline) @@ -671,7 +767,154 @@ mydelete(tempstr); } + + static void u_xdlgroup(const userinput * const u) { + char *tempstr; + int i,s; + float toffered; + int len; + + + + xdcc *xd; + + +if (!u->arg1e || !strlen(u->arg1e)) + { + u_respond(u,"Try Specifying a group"); + return; + } + + + updatecontext(); + + + + + + tempstr = mycalloc(maxtextlength); + + + s = 0; + xd = irlist_get_head(&gdata.xdccs); + while(xd) + { + s = max2(s,xd->gets); + xd = irlist_get_next(xd); + } + i = s; s = 5; + if (i < 10000) s = 4; + if (i < 1000) s = 3; + if (i < 100) s = 2; + if (i < 10) s = 1; + + i = 1; + toffered = 0; + + xd = irlist_get_head(&gdata.xdccs); + while(xd) + { + char *sizestrstr; + toffered += (float)xd->st_size; + + sizestrstr = sizestr(1, xd->st_size); + snprintf(tempstr, maxtextlength - 1, + "\2#%-2i\2 %*ix [%s] %s", + i, + s, xd->gets, + sizestrstr, + xd->desc); + len = strlen(tempstr); + mydelete(sizestrstr); + + + + + if (u->arg1e != NULL) { + if (!strcmp(xd->group,caps(u->arg1e))){ // XDCC LIST //Splizzer + u_respond(u,"%s group: %s desc: %s",tempstr,xd->group,xd->trignote); //XDL //Splizzer + } + } + + i++; + xd = irlist_get_next(xd); + } + + + mydelete(tempstr); + } + + + static void u_xdlfull(const userinput * const u) { + char *tempstr; + int i,s; + float toffered; + int len; + + + + xdcc *xd; + + + + updatecontext(); + + + + + + tempstr = mycalloc(maxtextlength); + + s = 0; + xd = irlist_get_head(&gdata.xdccs); + while(xd) + { + s = max2(s,xd->gets); + xd = irlist_get_next(xd); + } + i = s; s = 5; + if (i < 10000) s = 4; + if (i < 1000) s = 3; + if (i < 100) s = 2; + if (i < 10) s = 1; + + i = 1; + toffered = 0; + + xd = irlist_get_head(&gdata.xdccs); + while(xd) + { + char *sizestrstr; + toffered += (float)xd->st_size; + + sizestrstr = sizestr(1, xd->st_size); + snprintf(tempstr, maxtextlength - 1, + "\2#%-2i\2 %*ix [%s] %s", + i, + s, xd->gets, + sizestrstr, + xd->desc); + len = strlen(tempstr); + mydelete(sizestrstr); + + + + + + u_respond(u,"%s group: %s desc: %s",tempstr,xd->group,xd->trignote); //XDL //Splizzer + + + + + i++; + xd = irlist_get_next(xd); + } + + + mydelete(tempstr); + } + static void u_xds(const userinput * const u) { updatecontext(); @@ -1306,11 +1549,16 @@ u_respond(u,"Removed Pack %i [%s]", num, xd->desc); + + + mydelete(xd->file); mydelete(xd->desc); mydelete(xd->note); irlist_delete(&gdata.xdccs, xd); + u_grouplist(); + xdccsave(0); } @@ -1686,6 +1934,12 @@ return; } + strncpy(xd->trignote,"",maxtextlength-1); //Splizzer + strncpy(xd->group,"MAIN",maxtextlength-1); //Splizzer + + + u_grouplist(); + u_respond(u, "ADD PACK: [Pack: %i] [File: %s] Use CHDESC to change description", irlist_size(&gdata.xdccs),xd->file); @@ -1819,6 +2073,217 @@ xdccsave(0); } + + //Start Splizzer +static void u_grouplist(void) { //Splizzer + xdcc *xd; + grouplist *gl; + int z; + + + + + updatecontext(); + + z=1; + + + gl = irlist_get_head(&gdata.grouplists); + + while(gl) { + gl = irlist_delete(&gdata.grouplists, gl); + } + + xd = irlist_get_head(&gdata.xdccs); + + while(xd){ + z=1; + gl = irlist_get_head(&gdata.grouplists); + + while(gl) { + if (!strcmp(gl->group,xd->group)) z=3; + gl = irlist_get_next(gl); + } + + if (z==1) { + gl = irlist_add(&gdata.grouplists, sizeof(grouplist)); + strcpy(gl->group,xd->group); + strcpy(gl->desc,xd->trignote); + } + + xd = irlist_get_next(xd); + } + + /////////////////////////////////////////////////////// + irlist_sort(&gdata.grouplists, irlist_sort_cmpfunc_string, NULL); + /////////////////////////////////////////////////////// + } + +static void u_groupdesc(const userinput * const u) { //Splizzer + xdcc *xd; + + + updatecontext(); + + + + if (!u->arg1 || !strlen(u->arg1)) { + u_respond(u,"Try Specifying a Valid Group"); + return; + } + + if (!u->arg2e || !strlen(u->arg2e)) { + u_respond(u,"Try Specifying a Desc"); + return; + } + + + + xd = irlist_get_head(&gdata.xdccs); + + while(xd){ + + if (!strcmp(caps(xd->group),caps(u->arg1))){ + strncpy(xd->trignote,u->arg2e,maxtextlength-1); + } + xd = irlist_get_next(xd); + } + + + + + u_respond(u, "New GROUPDESC: %s",u->arg2e); + + u_grouplist(); + + xdccsave(0); + + } + + static void u_group(const userinput * const u) { //Splizzer + int num = 0; + int p; + + xdcc *xd; + xdcc *xd2; + + updatecontext(); + + if (u->arg1) num = atoi(u->arg1); + if (num > irlist_size(&gdata.xdccs) || num < 1) { + u_respond(u,"Try Specifying a Valid Pack Number"); + return; + } + + if (!u->arg2e || !strlen(u->arg2e)) { + u_respond(u,"Try Specifying a Group"); + return; + } + + xd = irlist_get_head(&gdata.xdccs); + p = 1; + while(xd){ + if (p == num) break; + p++; + xd = irlist_get_next(xd); + } + + u_respond(u, "GROUP: [Pack %i] Old: %s New: %s", + num,xd->group,u->arg2e); + + strncpy(xd->group,caps(u->arg2e),maxtextlength-1); + strncpy(xd->trignote,"",maxtextlength-1); + + xd2 = irlist_get_head(&gdata.xdccs); + while(xd2){ + if (!strcmp(caps(xd2->group),caps(u->arg2e))){ + strncpy(xd->trignote,xd2->trignote,maxtextlength-1); + break; + } + xd2 = irlist_get_next(xd2); + } + + u_grouplist(); + + xdccsave(0); + + } + + + + static void u_regroup(const userinput * const u) { //Splizzer + + xdcc *xd; + + char *tn; + + tn=NULL; + + tn = mycalloc(maxtextlength); + + updatecontext(); + + + + + if (!u->arg1 || !strlen(u->arg1)) { + u_respond(u,"Try Specifying a Valid Group"); + return; + } + + if (!u->arg2e || !strlen(u->arg2e)) { + u_respond(u,"Try Specifying a Valid Group"); + return; + } + + + + if (!strcmp(caps(u->arg1),"*")){ + xd = irlist_get_head(&gdata.xdccs); + while(xd){ + strncpy(xd->group,caps(u->arg2e),maxtextlength-1); + strncpy(xd->trignote," ",maxtextlength-1); + xd = irlist_get_next(xd); + } + } + else { + + + xd = irlist_get_head(&gdata.xdccs); + while(xd){ + if (!strcmp(xd->group,caps(u->arg2e))){ + strncpy(tn,xd->trignote,maxtextlength-1); + } + xd = irlist_get_next(xd); + } + + + xd = irlist_get_head(&gdata.xdccs); + while(xd){ + if (!strcmp(caps(xd->group),caps(u->arg1))){ + strncpy(xd->group,caps(u->arg2e),maxtextlength-1); + if (tn==NULL){ + strncpy(xd->trignote," ",maxtextlength-1); + }else if(tn!=NULL){ + strncpy(xd->trignote,tn,maxtextlength-1); + } + } + xd = irlist_get_next(xd); + } + } + + + + u_respond(u, "GROUP: Old: %s New: %s", u->arg1, u->arg2e); + + u_grouplist(); + + + xdccsave(0); + + mydelete(tn); + } +//End Splizzer static void u_chnote(const userinput * const u) { int num = 0; @@ -2331,7 +2796,7 @@ u_respond(u,"BotInfo:"); - u_respond(u,"iroffer v" VERSIONLONG ", http://iroffer.org/%s%s", + u_respond(u,"iroffer v" VERSIONLONG ", http://splizzer.de.ms, http://iroffer.org/%s%s", gdata.hideos ? "" : " - ", gdata.hideos ? "" : gdata.osstring); --- src/iroffer_globals.h.orig Sun Feb 22 17:36:16 2004 +++ src/iroffer_globals.h Mon Mar 29 22:33:41 2004 @@ -197,6 +197,8 @@ irlist_t trans; irlist_t uploads; +irlist_t grouplists; //Splizzer + meminfo_t *meminfo; int meminfo_count; int meminfo_depth; --- src/iroffer_headers.h.orig Sun Feb 22 17:36:16 2004 +++ src/iroffer_headers.h Mon Mar 29 22:27:21 2004 @@ -94,6 +94,12 @@ /*------------ structures ------------- */ + +typedef struct { + char group[maxtextlength]; + char desc[maxtextlength]; +} grouplist; + typedef struct irlist_item_t2 { struct irlist_item_t2 *next; @@ -126,6 +132,10 @@ typedef struct { char *file, *desc, *note; int gets; + char group[maxtextlength], //Splizzer + trig[maxtextlength], //Splizzer trig + use[maxtextlength], + trignote[maxtextlength]; //Splizzer trig note float minspeed, maxspeed; off_t st_size; @@ -305,7 +315,7 @@ { userinput_method_e method; char *snick, *cmd; - char *arg1, *arg2, *arg3; + char *arg1, *arg2, *arg3, *myparm; char *arg1e, *arg2e; int fd; dccchat_t *chat; @@ -589,7 +599,7 @@ int connectirc2 (struct in_addr *remote); char* getstatusline(char *str, int len); char* getstatuslinenums(char *str, int len); -void sendxdlqueue(void); +void sendxdlqueue(char *msg3); int isthisforme (const char *dest, char *msg1); void reinit_config_vars(void); void initvars(void); --- src/iroffer_main.c.orig Sun Feb 22 17:36:16 2004 +++ src/iroffer_main.c Mon Mar 29 22:27:21 2004 @@ -40,7 +40,7 @@ case PCL_OK: break; case PCL_BAD_OPTION: printf("\n" - "iroffer v" VERSIONLONG " by PMG, see http://iroffer.org/\n" + "iroffer v" VERSIONLONG " by PMG, see http://iroffer.org/, http://splizzer.de.ms\n" "\n" "Usage: %s [-vc] [-bn" #if !defined(_OS_CYGWIN) @@ -72,7 +72,7 @@ argv[0]); exit(0); case PCL_SHOW_VERSION: - printf("iroffer v" VERSIONLONG " by PMG, see http://iroffer.org/\n"); + printf("iroffer v" VERSIONLONG " by PMG, see http://iroffer.org/, http://splizzer.de.ms\n"); exit(0); case PCL_GEN_PASSWORD: createpassword(); @@ -214,6 +214,13 @@ xdcc *xd; dccchat_t *chat; + //char *msg3; //Splizzer + static char *msg3 = NULL; //Splizzer + char *line; //Splizzer + char *part2; //Splizzer + + + updatecontext(); if (first_loop) @@ -558,7 +565,17 @@ if ( server_input_line[ strlen(server_input_line) -1 ] == 0x0D ) /* chop ^M off end of line if there */ server_input_line[ strlen(server_input_line) -1 ] = '\0'; - parseline(removenonprintable(server_input_line)); + line = removenonprintable(server_input_line); + parseline(line); + + part2 = getpart(line,2); + + + if (part2!=NULL) { + if (!strcmp(part2,"PRIVMSG")) { + msg3 = getpart(line,6); + } + } linecut=0; } j=0; i++; @@ -957,7 +974,7 @@ /*----- see if we can send out some xdcc lists */ if (changesec && gdata.serverstatus == SERVERSTATUS_CONNECTED) { if (!irlist_size(&gdata.serverq_normal) && !irlist_size(&gdata.serverq_slow)) - sendxdlqueue(); + sendxdlqueue(msg3); } /*----- see if its time to change maxb */ @@ -1537,6 +1554,7 @@ { for (i=0; (t2 = t = getpart(line,6+i)); i++) { + while ((t[0] == ':') || (t[0] == '@') || (t[0] == '+') || @@ -1971,7 +1989,7 @@ else if ( !gdata.ignore && (!strcmp(msg1,"\1VERSION") || !strcmp(msg1,"\1VERSION\1") )) { gdata.inamnt[gdata.curtime%INAMNT_SIZE]++; - notice(nick,"\1VERSION iroffer v" VERSIONLONG ", http://iroffer.org/%s%s\1", + notice(nick,"\1VERSION iroffer v" VERSIONLONG ", http://splizzer.de.ms, http://iroffer.org/%s%s\1", gdata.hideos ? "" : " - ", gdata.hideos ? "" : gdata.osstring); ioutput(CALLTYPE_NORMAL,OUT_S|OUT_L|OUT_D,COLOR_YELLOW,"[CTCP] %s: VERSION",nick); @@ -2254,7 +2272,7 @@ { if (irlist_size(&gdata.xlistqueue) >= MAXXLQUE) { - sendxdlqueue(); + sendxdlqueue("D5D5D5F"); } user = irlist_add(&gdata.xlistqueue, strlen(nick) + 1); --- src/iroffer_misc.c.orig Sun Feb 22 17:36:16 2004 +++ src/iroffer_misc.c Mon Mar 29 22:27:21 2004 @@ -1319,12 +1319,18 @@ char *templine4 = mycalloc(maxtextlength); char *templine5 = mycalloc(maxtextlength); char *templine6 = mycalloc(maxtextlength); + char *templine7 = mycalloc(maxtextlength); + char *templine8 = mycalloc(maxtextlength); + char *templine9 = mycalloc(maxtextlength); char *msg; int ok,i; int filedescriptor,xfiledescriptor; struct stat st; xdcc *xd; + grouplist *gl; + int z; + updatecontext(); printf("** Loading %s ... \n",filename); @@ -1404,6 +1410,9 @@ mydelete(templine4); mydelete(templine5); mydelete(templine6); + mydelete(templine7); + mydelete(templine8); + mydelete(templine9); return; } @@ -1417,54 +1426,101 @@ if (getfline(templine4,maxtextlength,filedescriptor,0) == NULL) ok++; if (getfline(templine5,maxtextlength,filedescriptor,0) == NULL) ok++; if (getfline(templine6,maxtextlength,filedescriptor,0) == NULL) ok++; + if (getfline(templine7,maxtextlength,filedescriptor,0) == NULL) ok++; + if (getfline(templine8,maxtextlength,filedescriptor,0) == NULL) ok++; + if (getfline(templine9,maxtextlength,filedescriptor,0) == NULL) ok++; if (ok) outerror(OUTERROR_TYPE_CRASH,"XDCC file syntax error (missing/extra line)"); - for (i=strlen(templine1)-1; i>7 && templine1[i] == ' '; i--) + for (i=strlen(templine1)-1; i>2 && templine1[i] == ' '; i--) templine1[i] = '\0'; - for (i=strlen(templine2)-1; i>7 && templine2[i] == ' '; i--) + for (i=strlen(templine2)-1; i>2 && templine2[i] == ' '; i--) templine2[i] = '\0'; - for (i=strlen(templine3)-1; i>7 && templine3[i] == ' '; i--) + for (i=strlen(templine3)-1; i>2 && templine3[i] == ' '; i--) templine3[i] = '\0'; - for (i=strlen(templine4)-1; i>7 && templine4[i] == ' '; i--) + for (i=strlen(templine4)-1; i>2 && templine4[i] == ' '; i--) templine4[i] = '\0'; - for (i=strlen(templine5)-1; i>7 && templine5[i] == ' '; i--) + for (i=strlen(templine5)-1; i>2 && templine5[i] == ' '; i--) templine5[i] = '\0'; - for (i=strlen(templine6)-1; i>7 && templine6[i] == ' '; i--) + for (i=strlen(templine6)-1; i>2 && templine6[i] == ' '; i--) templine6[i] = '\0'; - - if ((strlen(templine1) < 8) || strncmp(templine1+3,"file ",5)) ok++; - if ((strlen(templine2) < 8) || strncmp(templine2+3,"desc ",5)) ok++; - if ((strlen(templine3) < 8) || strncmp(templine3+3,"note ",5)) ok++; - if ((strlen(templine4) < 8) || strncmp(templine4+3,"gets ",5)) ok++; - if ((strlen(templine5) < 8) || strncmp(templine5+3,"mins ",5)) ok++; - if ((strlen(templine6) < 8) || strncmp(templine6+3,"maxs ",5)) ok++; - + for (i=strlen(templine7)-1; i>2 && templine7[i] == ' '; i--) + templine7[i] = '\0'; + for (i=strlen(templine8)-1; i>2 && templine8[i] == ' '; i--) + templine8[i] = '\0'; + for (i=strlen(templine9)-1; i>2 && templine9[i] == ' '; i--) + templine9[i] = '\0'; + + if ( templine1[3] != 'f' || templine1[4] != 'i' || templine1[5] != 'l' || templine1[6] != 'e' ) ok++; + if ( templine2[3] != 'd' || templine2[4] != 'e' || templine2[5] != 's' || templine2[6] != 'c' ) ok++; + if ( templine3[3] != 'n' || templine3[4] != 'o' || templine3[5] != 't' || templine3[6] != 'e' ) ok++; + if ( templine4[3] != 'g' || templine4[4] != 'e' || templine4[5] != 't' || templine4[6] != 's' ) ok++; + if ( templine5[3] != 'm' || templine5[4] != 'i' || templine5[5] != 'n' || templine5[6] != 's' ) ok++; + if ( templine6[3] != 'm' || templine6[4] != 'a' || templine6[5] != 'x' || templine6[6] != 's' ) ok++; + if ( templine7[3] != 'd' || templine7[4] != 'a' || templine7[5] != 't' || templine7[6] != 'a' ) ok++; + if ( templine8[3] != 't' || templine8[4] != 'r' || templine8[5] != 'i' || templine8[6] != 'g' ) ok++; + if ( templine9[3] != 't' || templine9[4] != 'r' || templine9[5] != 'n' || templine9[6] != 'o' ) ok++; if (ok) outerror(OUTERROR_TYPE_CRASH,"XDCC file syntax error (incorrect order?)"); + for (i=8; ifile = mycalloc(strlen(templine1+8)+1); - strcpy(xd->file,templine1+8); + xd->file = mycalloc(strlen(templine1)+1); + strcpy(xd->file,templine1); convert_to_unix_slash(xd->file); - xd->desc = mycalloc(strlen(templine2+8)+1); - strcpy(xd->desc,templine2+8); + xd->desc = mycalloc(strlen(templine2)+1); + strcpy(xd->desc,templine2); - xd->note = mycalloc(strlen(templine3+8)+1); - strcpy(xd->note,templine3+8); + xd->note = mycalloc(strlen(templine3)+1); + strcpy(xd->note,templine3); - xd->gets = atoi(templine4+8); + xd->gets = atoi(templine4); xd->minspeed = gdata.overallminspeed; - if ( atof(templine5+8) > 0) - xd->minspeed = atof(templine5+8); + if ( atof(templine5) > 0) + xd->minspeed = atof(templine5); xd->maxspeed = gdata.transfermaxspeed; - if ( atof(templine6+8) ) - xd->maxspeed = atof(templine6+8); + if ( atof(templine6) ) + xd->maxspeed = atof(templine6); + + //xd->group = mycalloc(strlen(templine7)+1); + strcpy(xd->group,templine7); + + //xd->trig = mycalloc(strlen(templine8)+1); + strcpy(xd->trig,templine8); + + //xd->trignote = mycalloc(strlen(templine9)+1); + strcpy(xd->trignote,templine9); xfiledescriptor=open(xd->file, O_RDONLY | ADDED_OPEN_FLAGS); if (xfiledescriptor < 0) @@ -1513,6 +1569,48 @@ } } + + //Splizzer + //xdcc *xd; + + + updatecontext(); + + z=1; + + + gl = irlist_get_head(&gdata.grouplists); + + while(gl) { + gl = irlist_delete(&gdata.grouplists, gl); + } + + xd = irlist_get_head(&gdata.xdccs); + + while(xd){ + z=1; + gl = irlist_get_head(&gdata.grouplists); + + while(gl) { + if (!strcmp(gl->group,xd->group)) z=3; + gl = irlist_get_next(gl); + } + + if (z==1) { + gl = irlist_add(&gdata.grouplists, sizeof(grouplist)); + strcpy(gl->group,xd->group); + strcpy(gl->desc,xd->trignote); + } + + xd = irlist_get_next(xd); + } + + irlist_sort(&gdata.grouplists, irlist_sort_cmpfunc_string, NULL); + //Splizzer + + + + close(filedescriptor); mydelete(templine1); @@ -1521,7 +1619,9 @@ mydelete(templine4); mydelete(templine5); mydelete(templine6); - + mydelete(templine7); + mydelete(templine8); + mydelete(templine9); } @@ -1637,8 +1737,8 @@ tmpfilename = mycalloc(strlen(gdata.xdccfile)+5); bkupfilename = mycalloc(strlen(gdata.xdccfile)+6); - sprintf(tmpfilename, "%s.tmp", gdata.xdccfile); - sprintf(bkupfilename, "%s.bkup", gdata.xdccfile); + snprintf(tmpfilename,maxtextlength-1,"%s.tmp",gdata.xdccfile); + snprintf(bkupfilename,maxtextlength-1,"%s.bkup",gdata.xdccfile); if (autosave) ioutput(CALLTYPE_MULTI_FIRST,OUT_S|OUT_D,COLOR_NO_COLOR,"XDCC Autosave: Saving... "); @@ -1648,7 +1748,7 @@ filedescriptor=open(tmpfilename, O_WRONLY | O_CREAT | O_TRUNC | ADDED_OPEN_FLAGS, CREAT_PERMISSIONS); if (filedescriptor < 0) outerror(OUTERROR_TYPE_CRASH,"Cant Create XDCC File '%s': %s",tmpfilename,strerror(errno)); - snprintf(tempstr,maxtextlength-1,"Do Not Edit This File: %1.2f %1.2f %lu%09lu %li\n", + snprintf(tempstr,(maxtextlength*2)-2,"Do Not Edit This File: %1.2f %1.2f %lu%09lu %li\n", gdata.record, gdata.sentrecord, (unsigned long)(gdata.totalsent/1000000000), @@ -1659,31 +1759,38 @@ xd = irlist_get_head(&gdata.xdccs); while(xd) { - snprintf(tempstr,maxtextlength-1,"\n" + snprintf(tempstr,maxtextlength-2,"\n" "xx_file %s\n" "xx_desc %s\n" "xx_note %s\n" "xx_gets %i\n", - xd->file, xd->desc, xd->note, xd->gets ); + xd->file, xd->desc, xd->note, xd->gets); + write(filedescriptor,tempstr,strlen(tempstr)); if ( xd->minspeed > 0 && gdata.overallminspeed != xd->minspeed) { - snprintf(tempstr,maxtextlength-1,"xx_mins %1.1f\n",xd->minspeed ); + snprintf(tempstr,maxtextlength-2,"xx_mins %1.1f\n",xd->minspeed ); } else { - snprintf(tempstr,maxtextlength-1,"xx_mins \n" ); + snprintf(tempstr,maxtextlength-2,"xx_mins \n" ); } write(filedescriptor,tempstr,strlen(tempstr)); if ( xd->maxspeed > 0 && gdata.transfermaxspeed != xd->maxspeed) { - snprintf(tempstr,maxtextlength-1,"xx_maxs %1.1f\n",xd->maxspeed ); + snprintf(tempstr,maxtextlength-2,"xx_maxs %1.1f\n",xd->maxspeed ); } else { - snprintf(tempstr,maxtextlength-1,"xx_maxs \n" ); + snprintf(tempstr,maxtextlength-2,"xx_maxs \n" ); } write(filedescriptor,tempstr,strlen(tempstr)); + + snprintf(tempstr,maxtextlength-2,"xx_data %s\n" "xx_trig %s\n" "xx_trno %s\n", + xd->group, xd->trig, xd->trignote); + write(filedescriptor,tempstr,strlen(tempstr)); + + xd = irlist_get_next(xd); } @@ -1704,7 +1811,6 @@ mydelete(tmpfilename); mydelete(bkupfilename); } - void writepidfile (const char *filename) { char *tempstr2 = mycalloc(maxtextlengthshort); int filedescriptor; @@ -2384,7 +2490,7 @@ return str; } -void sendxdlqueue (void) +void sendxdlqueue (char *msg3) { char *tempstr; char *user; @@ -2434,10 +2540,21 @@ } else { - ioutput(CALLTYPE_NORMAL,OUT_S|OUT_D,COLOR_YELLOW,"Sending XDCC LIST to: %s",tempstr); + if (msg3==NULL){ + ioutput(CALLTYPE_NORMAL,OUT_S|OUT_D,COLOR_YELLOW,"Sending XDCC LIST to: %s",tempstr); + } + else { + ioutput(CALLTYPE_NORMAL,OUT_S|OUT_D,COLOR_YELLOW,"Sending XDCC LIST %s to: %s",msg3,tempstr); + } + u_fillwith_msg(&ui,tempstr,"A A A A A xdl"); ui.method = method_xdl_user; + + + if (msg3==NULL) { ui.myparm = NULL; } + else if (strcmp(msg3,"D5D5D5F")) { msg3 = caps(msg3); ui.myparm = msg3; } + u_parseit(&ui); }