USE `vn`;
DROP function IF EXISTS `messageSend`;

DELIMITER $$
USE `vn`$$
CREATE DEFINER=`root`@`%` FUNCTION `messageSend`(vRecipient VARCHAR(255) CHARSET utf8, vMessage TEXT CHARSET utf8) RETURNS int(11)
BEGIN
	DECLARE result INT;
	DECLARE vSenderFk INT;
    
    SELECT id INTO vSenderFk 
		FROM account.user WHERE `name` = account.userGetName();
        
	RETURN (SELECT messageSendWithUser(vSenderFk, vRecipient, vMessage));
END$$

DELIMITER ;
