Fixed m_sendmessage to return the ID of the message sent

Hi,

  the m_sendmessage function is supposed to return the ID of the message sent, however it ends up only ever returning 0 (failed) or 1.

Daniel