// File: billDrett[P]Bulletin-Boards/boardServer.cpp
// Function: BoardServer::sendChanelsList()
void BoardServer::sendChanelsList()
{
    char convert[24];
    string buff;
    int nwrite;
    int total = 0;

    if((nwrite = write(pipeServer2BoardPost, "<Chanel>", 8))== -1) //start tag gia chanel
    {
        perror("Cant write to pipe S2BP");
    }

    //prwta to start tag
    if((nwrite = write(pipeServer2BoardPost, "<start>", 7))== -1)
    {
        perror("Cant write to pipe S2BP");
    }
    total += nwrite;
    for(Node<Chanel>* i = chanels->get_begin(); i != NULL; i = i->get_next()) //stelnw ena ena ta chanel
    {
        buff = i->get_data()->get_name(); //prwta to onoma
        buff.append(" ");
        sprintf(convert, "%d", i->get_data()->get_id()); //meta to id
        buff.append(convert);
        buff.append("\n");

        if((nwrite = write(pipeServer2BoardPost, buff.c_str(), buff.size()))== -1)
        {
            perror("Cant write to pipe S2BP");
            cout<<nwrite<<endl;
        }
        total += nwrite;
    }

    //telos to end tag
    if((nwrite = write(pipeServer2BoardPost, "<end>", 5))== -1)
    {
        perror("Cant write to pipe S2BP");
    }
    total += nwrite;
    if((nwrite = write(pipeServer2BoardPost, "<Chanel>", 8))== -1)
    {
        perror("Cant write to pipe S2BP");
    }
    total += nwrite;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x33e0
movq -0x90(%rbp), %rax
movl $0x0, -0x48(%rbp)
movl 0xc(%rax), %edi
leaq 0x50e1(%rip), %rsi      # 0xb0ac
movl $0x8, %edx
callq 0x3110
movq %rax, -0x88(%rbp)
jmp 0x5fde
movq -0x88(%rbp), %rax
movl %eax, -0x44(%rbp)
cmpl $-0x1, %eax
jne 0x6017
leaq 0x51e8(%rip), %rdi      # 0xb1dc
callq 0x3260
jmp 0x5ffb
jmp 0x6017
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x31f0
jmp 0x62d5
movq -0x90(%rbp), %rax
movl 0xc(%rax), %edi
leaq 0x50b1(%rip), %rsi      # 0xb0d9
movl $0x7, %edx
callq 0x3110
movq %rax, -0x98(%rbp)
jmp 0x603b
movq -0x98(%rbp), %rax
movl %eax, -0x44(%rbp)
cmpl $-0x1, %eax
jne 0x605a
leaq 0x518b(%rip), %rdi      # 0xb1dc
callq 0x3260
jmp 0x6058
jmp 0x605a
movq -0x90(%rbp), %rax
movl -0x44(%rbp), %edx
movl -0x48(%rbp), %ecx
addl %edx, %ecx
movl %ecx, -0x48(%rbp)
movq 0x30(%rax), %rdi
callq 0xa2a0
movq %rax, -0xa0(%rbp)
jmp 0x607e
movq -0xa0(%rbp), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
je 0x6229
movq -0x60(%rbp), %rdi
callq 0xaa50
movq %rax, -0xa8(%rbp)
jmp 0x60a6
movq -0xa8(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0xadb0
jmp 0x60b8
leaq -0x40(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
leaq -0x80(%rbp), %rsi
movq %rsi, -0xb8(%rbp)
callq 0x3380
movq -0xb8(%rbp), %rdi
callq 0x31f0
movq -0xb0(%rbp), %rdi
leaq 0x4fe1(%rip), %rsi      # 0xb0ce
callq 0x3500
jmp 0x60f4
leaq -0x20(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x60(%rbp), %rdi
callq 0xaa50
movq %rax, -0xc0(%rbp)
jmp 0x6111
movq -0xc0(%rbp), %rdi
callq 0xada0
movl %eax, -0xcc(%rbp)
jmp 0x6125
movl -0xcc(%rbp), %edx
movq -0xc8(%rbp), %rdi
leaq 0x4fa8(%rip), %rsi      # 0xb0e1
xorl %eax, %eax
callq 0x30a0
leaq -0x40(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x3500
jmp 0x614f
leaq 0x509e(%rip), %rsi      # 0xb1f4
leaq -0x40(%rbp), %rdi
callq 0x3500
jmp 0x6161
movq -0x90(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0xe4(%rbp)
leaq -0x40(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x3130
movq -0xf0(%rbp), %rdi
movq %rax, -0xe0(%rbp)
callq 0x3210
movl -0xe4(%rbp), %edi
movq -0xe0(%rbp), %rsi
movq %rax, %rdx
callq 0x3110
movq %rax, -0xd8(%rbp)
jmp 0x61b2
movq -0xd8(%rbp), %rax
movl %eax, -0x44(%rbp)
cmpl $-0x1, %eax
jne 0x61fe
leaq 0x5014(%rip), %rdi      # 0xb1dc
callq 0x3260
jmp 0x61cf
movl -0x44(%rbp), %esi
movq 0x8df7(%rip), %rdi      # 0xefd0
callq 0x34a0
movq %rax, -0xf8(%rbp)
jmp 0x61e7
movq -0xf8(%rbp), %rdi
movq 0x8dcb(%rip), %rsi      # 0xefc0
callq 0x3300
jmp 0x61fc
jmp 0x61fe
movl -0x44(%rbp), %eax
addl -0x48(%rbp), %eax
movl %eax, -0x48(%rbp)
movq -0x60(%rbp), %rdi
callq 0xaa30
movq %rax, -0x100(%rbp)
jmp 0x6219
movq -0x100(%rbp), %rax
movq %rax, -0x60(%rbp)
jmp 0x6089
movq -0x90(%rbp), %rax
movl 0xc(%rax), %edi
leaq 0x4fde(%rip), %rsi      # 0xb218
movl $0x5, %edx
callq 0x3110
movq %rax, -0x108(%rbp)
jmp 0x624d
movq -0x108(%rbp), %rax
movl %eax, -0x44(%rbp)
cmpl $-0x1, %eax
jne 0x626c
leaq 0x4f79(%rip), %rdi      # 0xb1dc
callq 0x3260
jmp 0x626a
jmp 0x626c
movq -0x90(%rbp), %rax
movl -0x44(%rbp), %edx
movl -0x48(%rbp), %ecx
addl %edx, %ecx
movl %ecx, -0x48(%rbp)
movl 0xc(%rax), %edi
leaq 0x4e24(%rip), %rsi      # 0xb0ac
movl $0x8, %edx
callq 0x3110
movq %rax, -0x110(%rbp)
jmp 0x629b
movq -0x110(%rbp), %rax
movl %eax, -0x44(%rbp)
cmpl $-0x1, %eax
jne 0x62ba
leaq 0x4f2b(%rip), %rdi      # 0xb1dc
callq 0x3260
jmp 0x62b8
jmp 0x62ba
movl -0x44(%rbp), %eax
addl -0x48(%rbp), %eax
movl %eax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x31f0
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x34b0
nop