Logo Search packages:      
Sourcecode: g2ipmsg version File versions  Download package

static int ipmsg_proc_send_info_packets ( const udp_con_t *  con,
const msg_data_t *  msg 
) [static]

IPMSGのIPMSG_SENDABSENCEINFO/IPMSG_SENDINFOパケットを処理する

Parameters:
[in] con UDPコネクション情報
[in] msg 受信したメッセージ情報
Return values:
0 正常終了
-EINVAL 引数異常
-ENOMEM メモリ不足

Definition at line 1687 of file protocol.c.

References info_message_window().

Referenced by ipmsg_proc_send_absence_info(), and ipmsg_proc_send_info().

                                                                          {
      int                           rc = 0;
      ipmsg_command_t received_command = 0;
      gchar                 *peer_name = NULL;

      dbg_out("here\n");

      g_assert( (con != NULL) && (msg != NULL) ); /* 呼び出し元責任で確認 */

      dbg_out("send absence info:version %s\n", msg->message);

      /*
       * 受信したコマンドを取得
       */
      received_command = IPMSG_NOOPERATION;
      rc = get_command_from_msg(msg, &received_command, NULL);
      if (rc != 0)
            goto error_out;

      /* ユーザ名をメッセージから抽出する  */
      peer_name = g_strdup(refer_user_name_from_msg(msg));
      if (peer_name == NULL) {
            rc = -ENOMEM;
            goto error_out;
      }

      /*  
       * 受信したメッセージを処理
       * peer_nameの開放は, 受け手で実施  
       */
      switch (received_command) {
      case IPMSG_SENDABSENCEINFO:
            info_message_window(peer_name, udp_get_peeraddr(con), 
                IPMSG_SENDABSENCEINFO, msg->message);
            break;
      case IPMSG_SENDINFO:
            info_message_window(peer_name, udp_get_peeraddr(con), 
                IPMSG_SENDINFO, msg->message);        
            break;
      default:
            break;
      }

      rc = 0; /* 正常終了 */

error_out:
      return rc;
}


Generated by  Doxygen 1.6.0   Back to index