right, but since the receive queue is maximally 4096 bytes, and mirc is able to read all 4096 bytes in a single /sockread &var, the point was not using a while loop in that case is the simplest and most efficient way forward
about the %1 business in your code, in general you should loop until $sockbr (after a /sockread) or $sock().rq become 0. here's yet another template code in addition to the one mentioned earlier, this is just to read a line at a time but any other sockread variation can be used as well:
on *:sockread:name:{
var %var
while ($sock($sockname).rq) {
sockread -f %var
echo -a * %var
}
}