jingle/send.c
author Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
Wed, 07 Jul 2010 23:02:01 +0200
changeset 35 a0fd92a93af7
parent 28 ed7520776c41
child 36 c300f2af08d0
permissions -rw-r--r--
Fix the function converting a JingleNode to a LmMessage. Also use the xmpp_helper lm_message_get_from.

/*
 * send.c
 *
 * Copyrigth (C) 2010 Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 * USA
 */

#include <glib.h>
#include <loudmouth/loudmouth.h>

#include <mcabber/xmpp_helper.h>
#include <mcabber/xmpp_defines.h>

#include <jingle/jingle.h>
#include <jingle/send.h>


void jingle_send_session_terminate(LmMessage *m, const gchar *reason)
{
  LmMessage *r;
  LmMessageNode *err;

  r = lm_message_new_iq_from_query(m, LM_MESSAGE_SUB_TYPE_SET);

  if (reason != NULL) {  
    err = lm_message_node_add_child(r->node, "reason", NULL);
    lm_message_node_add_child(err, reason, NULL);
  }

  // TODO vérifier que reason est connu

  if (r) {
	  lm_connection_send(lconnection, r, NULL);
	  lm_message_unref(r);
  }
}