mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 17:38:59 +00:00
your run-of-the mill nightmarish attempt at normalizing not one crazy protocol but many....
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3151 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -461,6 +461,19 @@ static ldl_status parse_session_code(ldl_handle_t *handle, char *id, char *from,
|
||||
|
||||
const char *marker = "TRUE";
|
||||
|
||||
static int on_vcard(void *user_data, ikspak *pak)
|
||||
{
|
||||
ldl_handle_t *handle = user_data;
|
||||
char *from = iks_find_attrib(pak->x, "from");
|
||||
char *to = iks_find_attrib(pak->x, "to");
|
||||
|
||||
if (handle->session_callback) {
|
||||
handle->session_callback(handle, NULL, LDL_SIGNAL_VCARD, to, from, pak->id, NULL);
|
||||
}
|
||||
|
||||
return IKS_FILTER_EAT;
|
||||
}
|
||||
|
||||
static int on_disco_info(void *user_data, ikspak *pak)
|
||||
{
|
||||
ldl_handle_t *handle = user_data;
|
||||
@@ -1240,6 +1253,8 @@ static void j_setup_filter(ldl_handle_t *handle)
|
||||
IKS_RULE_SUBTYPE, IKS_TYPE_GET, IKS_RULE_NS, "jabber:iq:register", IKS_RULE_DONE);
|
||||
iks_filter_add_rule(handle->filter, on_disco_reg_out, handle,
|
||||
IKS_RULE_SUBTYPE, IKS_TYPE_SET, IKS_RULE_NS, "jabber:iq:register", IKS_RULE_DONE);
|
||||
iks_filter_add_rule(handle->filter, on_vcard, handle,
|
||||
IKS_RULE_SUBTYPE, IKS_TYPE_GET, IKS_RULE_NS, "vcard-temp", IKS_RULE_DONE);
|
||||
} else {
|
||||
iks_filter_add_rule(handle->filter, on_disco_info, handle,
|
||||
IKS_RULE_NS, "http://jabber.org/protocol/disco#info", IKS_RULE_DONE);
|
||||
@@ -1571,6 +1586,34 @@ void ldl_handle_send_presence(ldl_handle_t *handle, char *from, char *to, char *
|
||||
do_presence(handle, from, to, type, rpid, message);
|
||||
}
|
||||
|
||||
void ldl_handle_send_vcard(ldl_handle_t *handle, char *from, char *to, char *id, char *vcard)
|
||||
{
|
||||
iks *vxml, *iq;
|
||||
int e = 0;
|
||||
|
||||
if (!(vxml = iks_tree(vcard, 0, &e))) {
|
||||
globals.logger(DL_LOG_ERR, "Parse returned error [%d]\n", e);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(iq = iks_new("iq"))) {
|
||||
globals.logger(DL_LOG_ERR, "Memory Error\n");
|
||||
return;
|
||||
}
|
||||
|
||||
iks_insert_attrib(iq, "to", to);
|
||||
iks_insert_attrib(iq, "xmlns", "jabber:client");
|
||||
iks_insert_attrib(iq,"from", from);
|
||||
iks_insert_attrib(iq, "type", "result");
|
||||
iks_insert_attrib(iq, "id", id);
|
||||
iks_insert_node(iq, vxml);
|
||||
|
||||
apr_queue_push(handle->queue, iq);
|
||||
|
||||
iks_free(vxml);
|
||||
|
||||
}
|
||||
|
||||
void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, char *subject, char *body)
|
||||
{
|
||||
iks *msg;
|
||||
|
@@ -126,6 +126,7 @@ typedef enum {
|
||||
LDL_SIGNAL_ROSTER,
|
||||
LDL_SIGNAL_SUBSCRIBE,
|
||||
LDL_SIGNAL_UNSUBSCRIBE,
|
||||
LDL_SIGNAL_VCARD,
|
||||
LDL_SIGNAL_TERMINATE,
|
||||
LDL_SIGNAL_ERROR,
|
||||
LDL_SIGNAL_LOGIN_SUCCESS,
|
||||
@@ -374,6 +375,16 @@ void ldl_session_send_msg(ldl_session_t *session, char *subject, char *body);
|
||||
*/
|
||||
void ldl_handle_send_presence(ldl_handle_t *handle, char *from, char *to, char *type, char *rpid, char *message);
|
||||
|
||||
/*!
|
||||
\brief Send a vcard
|
||||
\param handle the handle to send with
|
||||
\param from the from address
|
||||
\param to the to address
|
||||
\param id the request id
|
||||
\param vcard the text xml of the vcard
|
||||
*/
|
||||
void ldl_handle_send_vcard(ldl_handle_t *handle, char *from, char *to, char *id, char *vcard);
|
||||
|
||||
/*!
|
||||
\brief Send a message
|
||||
\param handle the conection handle
|
||||
|
Reference in New Issue
Block a user