mod-reorder_list
================
This modification for Arisa-chan <http://arisa-chan.org/> moves the
"Total Offered" statistics from to xdcc list to the end of the list for
a more iroffer-like behaviour.

Author: Nei <hsim at gmx dot li>
License: GNU General Public License Version 2 or any later one


diff -urp arisa-041123.00b/src/pack.c arisa-new/src/pack.c
--- arisa-041123.00b/src/pack.c	2004-11-20 11:48:12.000000000 +0100
+++ arisa-new/src/pack.c	2004-11-23 07:04:38.000000000 +0100
@@ -602,10 +602,8 @@ long savgspeed(pool_t *p) {
 void packlist_xdl_head(packlist_t *l, pqueue_t *q, colourtype_t colour, 
 			const char *prefix, const char *postfix, int addtail) {
 	char buffer[512];
-	char bqueue[32],bcap[32],bmin[32],bmax[32],btmp1[16],btmp2[16];
+	char bqueue[32],bcap[32],bmin[32],bmax[32];
 	char *bold,*unbold;
-	unsigned long long xfer,size;
-	int i;
 	
 	if(colour == COLOUR_IRC)
 		bold = unbold = IRC_BOLD;
@@ -667,24 +665,9 @@ void packlist_xdl_head(packlist_t *l, pq
 		postfix
 	);
 	pqueue_push_back(q,xstrdup(buffer));
-	xfer = ((unsigned long long)l->queue->pool->stat_mib)*(1024*1024) +
-		(unsigned long long)l->queue->pool->stat_carry;
 	UNLOCK(l->queue->pool);
 	UNLOCK(l->queue);
 	
-	for(i = 0, size = 0; i < l->no_packs; ++i) {
-		RLOCK(l->packs[i]);
-		size += (unsigned long long) l->packs[i]->size;
-		RUNLOCK(l->packs[i]);
-	}
-	snprintf(buffer,sizeof(buffer),
-		"%s%s**%s Total Offered: %s, Total Transferred: %s %s**%s%s",
-		prefix,bold,unbold,
-		format_bytes(btmp1,sizeof(btmp1),size,1),
-		format_bytes(btmp2,sizeof(btmp2),xfer,1),
-		bold,unbold,postfix);
-	pqueue_push_back(q,xstrdup(buffer));
-			
	if(addtail) {
		snprintf(buffer,sizeof(buffer),
			"%s%s**%s To request a file type: \"/msg $BOT xdcc send %s #x\" %s**%s%s",
@@ -778,7 +761,19 @@ void packlist_xdl_tail(packlist_t *l, pq
 		const char *prefix, const char *postfix) {
 	char name[128];
 	int done = 0;
+	char buffer[512];
+	char btmp1[16],btmp2[16];
+	char *bold,*unbold;
+	unsigned long long xfer,size;
+	int i;
 
+	if(colour == COLOUR_IRC)
+		bold = unbold = IRC_BOLD;
+	else if(colour == COLOUR_INT)
+		bold = unbold = COLOUR_BOLD;
+	else
+		bold = unbold = "";	
+	
 	LOCK(l);
 	xstrncpy(name,l->name,sizeof(name));
 	UNLOCK(l);
@@ -813,6 +808,28 @@ void packlist_xdl_tail(packlist_t *l, pq
 				prefix,postfix);
 		UNLOCK(global);
 	}
+
+	LOCK(l);
+	LOCK(l->queue);
+	LOCK(l->queue->pool);
+	xfer = ((unsigned long long)l->queue->pool->stat_mib)*(1024*1024) +
+		(unsigned long long)l->queue->pool->stat_carry;
+	UNLOCK(l->queue->pool);
+	UNLOCK(l->queue);
+
+	for(i = 0, size = 0; i < l->no_packs; ++i) {
+		RLOCK(l->packs[i]);
+		size += (unsigned long long) l->packs[i]->size;
+		RUNLOCK(l->packs[i]);
+	}
+	UNLOCK(l);
+	snprintf(buffer,sizeof(buffer),
+		"%s%s**%s Total Offered: %s, Total Transferred: %s %s**%s%s",
+		prefix,bold,unbold,
+		format_bytes(btmp1,sizeof(btmp1),size,1),
+		format_bytes(btmp2,sizeof(btmp2),xfer,1),
+		bold,unbold,postfix);
+	pqueue_push_back(q,xstrdup(buffer));
 }
 
 int pack_ref(pack_t *p) {

