- (IBAction)sendMessage:(id)sender {
if(self.sendMessageField.text.length == 0){
return;
}
// Send message to opponent
if(self.opponent)
{
// send message
QBChatMessage *message = [[QBChatMessage alloc] init];
message.recipientJID = [NSString stringWithFormat:@"%d",opponent.ID];
message.senderJID = [NSString stringWithFormat:@"%d",[[DataManager shared] currentUser].ID];
message.text = self.sendMessageField.text;
BOOL sent = [[QBChat instance] sendMessage:message];
NSLog(@"%d",sent);
// save message to cache