提交 0ea84c86 authored 作者: Anthony Minessale's avatar Anthony Minessale

presence update

上级 62206e3d
......@@ -522,7 +522,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event)
alt_event_type = "presence";
}
if ((user = strdup(from))) {
if (from && (user = strdup(from))) {
if ((host = strchr(user, '@'))) {
char *p;
*host++ = '\0';
......@@ -1065,7 +1065,7 @@ static char *gen_pidf(char *user_agent, char *id, char *url, char *open, char *r
*ct = "application/xpidf+xml";
/* If unknown/none prpid is provided, just show the user as online. */
if (!prpid) {
if (!prpid || !strcasecmp(prpid, "unknown")) {
prpid = "online";
}
......@@ -1099,10 +1099,13 @@ static char *gen_pidf(char *user_agent, char *id, char *url, char *open, char *r
}
if (!strncasecmp(status, "Registered", 10)) {
prpid = NULL;
status = "Available";
}
if (!strcasecmp(status, "Available")) {
prpid = NULL;
}
if (!strcasecmp(status, "Unregistered")) {
prpid = NULL;
......@@ -1116,6 +1119,7 @@ static char *gen_pidf(char *user_agent, char *id, char *url, char *open, char *r
if (zstr(status) && !zstr(prpid)) {
status = "Available";
prpid = NULL;
}
if (prpid) {
......
......@@ -1336,7 +1336,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "login", profile->name);
switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, reg_host);
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "rpid", "online");
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "rpid", "unknown");
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "status", "Registered");
switch_event_fire(&s_event);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论