#include "../../str.h"#include "xjab_jconf.h"#include "xjab_base.h"#include "tree234.h"#include "xjab_presence.h"


Go to the source code of this file.
| #define XJ_AIM_LEN 4 |
| #define XJ_AIM_NAME "aim." |
| #define XJ_ICQ_LEN 3 |
| #define XJ_ICQ_NAME "icq" |
| #define XJ_JCMD_SUBSCRIBE 1 |
Definition at line 56 of file xjab_jcon.h.
| #define XJ_JCMD_UNSUBSCRIBE 2 |
Definition at line 57 of file xjab_jcon.h.
Referenced by xj_jcon_del_jconf(), and xj_worker_process().
| #define XJ_JMSG_CHAT 2 |
Definition at line 53 of file xjab_jcon.h.
Referenced by xj_jcon_send_msg(), xj_worker_check_qmsg(), and xj_worker_process().
| #define XJ_JMSG_GROUPCHAT 4 |
Definition at line 54 of file xjab_jcon.h.
Referenced by xj_jcon_send_msg(), xj_worker_check_qmsg(), and xj_worker_process().
| #define XJ_JMSG_NORMAL 1 |
Definition at line 52 of file xjab_jcon.h.
| #define XJ_MSN_LEN 4 |
| #define XJ_MSN_NAME "msn." |
| #define XJ_NET_AIM 2 |
| #define XJ_NET_ALL 0xFFFFFFFF |
| #define XJ_NET_ICQ 4 |
| #define XJ_NET_JAB 1 |
| #define XJ_NET_MSN 8 |
| #define XJ_NET_NUL 0 |
| #define XJ_NET_YAH 16 |
| #define XJ_YAH_LEN 6 |
| #define XJ_YAH_NAME "yahoo." |
Definition at line 727 of file xjab_jcon.c.
References find234(), _xj_jcon::jconf, _str::len, LM_DBG, _xj_jcon::nrjconf, NULL, _str::s, xj_jconf_free(), xj_jconf_init_jab(), and xj_jconf_new().
Referenced by xj_manage_jab().
| int xj_jcon_connect | ( | xj_jcon | jbc | ) |
connect to JABBER server
Definition at line 97 of file xjab_jcon.c.
References _xj_jcon::hostname, LM_DBG, NULL, _xj_jcon::port, _xj_jcon::sock, and sock.
Referenced by xj_worker_process().
Definition at line 774 of file xjab_jcon.c.
References del234(), _xj_jkey::id, _xj_jcon::jconf, _xj_jcon::jkey, _str::len, LM_DBG, _xj_jcon::nrjconf, NULL, _str::s, XJ_JCMD_UNSUBSCRIBE, xj_jcon_jconf_presence(), xj_jconf_free(), xj_jconf_init_sip(), and xj_jconf_new().
Referenced by xj_worker_process().
| int xj_jcon_disconnect | ( | xj_jcon | jbc | ) |
disconnect from JABBER server
Definition at line 158 of file xjab_jcon.c.
References LM_DBG, NULL, _xj_jcon::sock, and xj_jcon_send_presence().
Referenced by xj_worker_check_jcons(), and xj_worker_process().
| int xj_jcon_free | ( | xj_jcon | jbc | ) |
free the allocated memory space of a JABBER connection
Definition at line 560 of file xjab_jcon.c.
References _M_FREE, delpos234(), _xj_jcon::hostname, _xj_jcon::jconf, LM_DBG, _xj_jcon::nrjconf, NULL, _xj_jcon::plist, _xj_jcon::resource, _xj_jcon::stream_id, xj_jconf_free(), and xj_pres_list_free().
Referenced by xj_jcon_pool_del(), xj_jcon_pool_free(), xj_worker_check_jcons(), and xj_worker_process().
Definition at line 682 of file xjab_jcon.c.
References add234(), find234(), _xj_jkey::id, _xj_jcon::jconf, _xj_jcon::jkey, _str::len, LM_DBG, newtree234(), _xj_jcon::nrjconf, NULL, _str::s, xj_jconf_cmp(), xj_jconf_free(), xj_jconf_init_sip(), xj_jconf_new(), and XJ_MAX_JCONF.
Referenced by xj_jcon_is_ready(), and xj_worker_process().
| int xj_jcon_get_juid | ( | xj_jcon | jbc | ) |
return the Jabber internal ID
Definition at line 148 of file xjab_jcon.c.
References _xj_jcon::juid, and NULL.
| int xj_jcon_get_roster | ( | xj_jcon | jbc | ) |
receive the list of the roster
Definition at line 346 of file xjab_jcon.c.
References JB_IQ_ROSTER_GET, and _xj_jcon::sock.
Referenced by xj_worker_process().
| xj_jcon xj_jcon_init | ( | char * | hostname, | |
| int | port | |||
| ) |
---
init a JABBER connection
Definition at line 60 of file xjab_jcon.c.
References _M_FREE, _M_MALLOC, _xj_jcon::allowed, _xj_jcon::hostname, _xj_jcon::jconf, _xj_jcon::juid, _xj_jcon::nrjconf, NULL, _xj_jcon::plist, _xj_jcon::port, _xj_jcon::ready, _xj_jcon::seq_nr, _xj_jcon::sock, XJ_NET_NUL, and xj_pres_list_init().
Referenced by xj_worker_process().
| int xj_jcon_is_ready | ( | xj_jcon | , | |
| char * | , | |||
| int | , | |||
| char | ||||
| ) |
Definition at line 636 of file xjab_jcon.c.
References _xj_jcon::allowed, _str::len, LM_DBG, NULL, _xj_jcon::ready, _str::s, _xj_jconf::status, XJ_AIM_LEN, XJ_AIM_NAME, XJ_ICQ_LEN, XJ_ICQ_NAME, xj_jcon_get_jconf(), xj_jconf_check_addr(), XJ_JCONF_READY, XJ_MSN_LEN, XJ_MSN_NAME, XJ_NET_AIM, XJ_NET_ICQ, XJ_NET_MSN, XJ_NET_YAH, XJ_YAH_LEN, and XJ_YAH_NAME.
Referenced by xj_worker_check_qmsg(), and xj_worker_process().
Definition at line 759 of file xjab_jcon.c.
References _str::len, _xj_jconf::nick, NULL, _xj_jconf::room, _str::s, _xj_jconf::server, and xj_jcon_send_presence().
Referenced by xj_jcon_del_jconf(), xj_manage_jab(), xj_worker_check_jcons(), and xj_worker_process().
| int xj_jcon_send_msg | ( | xj_jcon | jbc, | |
| char * | to, | |||
| int | tol, | |||
| char * | msg, | |||
| int | msgl, | |||
| int | type | |||
| ) |
send a message through a JABBER connection params are pairs (buffer, len)
Definition at line 403 of file xjab_jcon.c.
References LM_DBG, NULL, _xj_jcon::sock, XJ_JMSG_CHAT, XJ_JMSG_GROUPCHAT, xode_free(), xode_insert_cdata(), xode_new_tag(), xode_put_attrib(), xode_to_str(), and xode_wrap().
Referenced by xj_worker_check_qmsg(), and xj_worker_process().
| int xj_jcon_send_presence | ( | xj_jcon | jbc, | |
| char * | sto, | |||
| char * | type, | |||
| char * | status, | |||
| char * | priority | |||
| ) |
send presence type - "unavailable", "subscribe", "subscribed" .... status - "online", "away", "unavailable" ... priority - "0", "1", ...
Definition at line 470 of file xjab_jcon.c.
References LM_DBG, NULL, _xj_jcon::sock, xode_free(), xode_insert_cdata(), xode_insert_tag(), xode_new_tag(), xode_put_attrib(), and xode_to_str().
Referenced by xj_jcon_disconnect(), xj_jcon_jconf_presence(), xj_manage_jab(), and xj_worker_process().
| int xj_jcon_send_sig_msg | ( | xj_jcon | , | |
| char * | , | |||
| int | , | |||
| char * | , | |||
| int | , | |||
| char * | , | |||
| int | ||||
| ) |
| int xj_jcon_send_subscribe | ( | xj_jcon | jbc, | |
| char * | to, | |||
| char * | from, | |||
| char * | type | |||
| ) |
send subscribe for user's presence
Definition at line 522 of file xjab_jcon.c.
References LM_DBG, NULL, _xj_jcon::sock, xode_free(), xode_new_tag(), xode_put_attrib(), and xode_to_str().
Referenced by xj_worker_check_watcher().
create a open connection to Jabber
Definition at line 605 of file xjab_jcon.c.
References _xj_jcon::expire, get_ticks(), _xj_jkey::id, _xj_jcon::jkey, NULL, _xj_jcon::ready, and _str::s.
Referenced by xj_worker_process().
| void xj_jcon_set_juid | ( | xj_jcon | jbc, | |
| int | _juid | |||
| ) |
set the Jabber internal ID
Definition at line 138 of file xjab_jcon.c.
References _xj_jcon::juid, and NULL.
| int xj_jcon_set_roster | ( | xj_jcon | jbc, | |
| char * | jid, | |||
| char * | type | |||
| ) |
add a new contact in user's roster
Definition at line 357 of file xjab_jcon.c.
References LM_DBG, NULL, _xj_jcon::seq_nr, _xj_jcon::sock, xode_free(), xode_new_tag(), xode_put_attrib(), xode_to_str(), and xode_wrap().
| int xj_jcon_update | ( | xj_jcon | jbc, | |
| int | cache_time | |||
| ) |
update the life time of the connection
Definition at line 624 of file xjab_jcon.c.
References _xj_jcon::expire, get_ticks(), _xj_jkey::id, _xj_jcon::jkey, _str::len, LM_DBG, NULL, and _str::s.
Referenced by xj_worker_process().
| int xj_jcon_user_auth | ( | xj_jcon | jbc, | |
| char * | username, | |||
| char * | passwd, | |||
| char * | resource | |||
| ) |
authentication to the JABBER server
Definition at line 181 of file xjab_jcon.c.
References _M_MALLOC, _xj_jcon::allowed, _xj_jcon::hostname, JB_CLIENT_OPEN_STREAM, JB_START_STREAM, JB_START_STREAM_LEN, NULL, _xj_jcon::ready, _xj_jcon::resource, _xj_jcon::seq_nr, shahash(), _xj_jcon::sock, _xj_jcon::stream_id, XJ_NET_ALL, XJ_NET_JAB, xode_free(), xode_from_strx(), xode_get_attrib(), xode_get_name(), xode_get_tag(), xode_insert_cdata(), xode_insert_tag(), xode_new_tag(), xode_put_attrib(), xode_to_str(), and xode_wrap().
Referenced by xj_worker_process().
1.5.6