Hi
The attached patch makes ssip-gst retry publication of presence if a
PUBLISH is challenged. It's just a copy-paste of ssip_r_subscribe().
Have a nice weekend
/Fredrik
diff -ru ssip-gst-1.0.0.orig/src/ssip.c ssip-gst-1.0.0/src/ssip.c
--- ssip-gst-1.0.0.orig/src/ssip.c 2006-01-18 03:59:15.000000000 +0100
+++ ssip-gst-1.0.0/src/ssip.c 2006-06-02 13:49:45.000000000 +0200
@@ -110,6 +110,9 @@
static void ssip_r_subscribe(int status, char const *phrase, nua_t *nua, ssip_t *ssip,
nua_handle_t *nh, ssip_oper_t *op, sip_t const *sip,
tagi_t tags[]);
+static void ssip_r_publish(int status, char const *phrase, nua_t *nua, ssip_t *ssip,
+ nua_handle_t *nh, ssip_oper_t *op, sip_t const *sip,
+ tagi_t tags[]);
static void ssip_r_authorize(int status, char const *phrase, nua_t *nua, ssip_t *ssip,
nua_handle_t *nh, ssip_oper_t *op, sip_t const *sip,
tagi_t tags[]);
@@ -211,6 +214,10 @@
ssip_r_subscribe(status, phrase, nua, ssip, nh, op, sip, tags);
break;
+ case nua_r_publish:
+ ssip_r_publish(status, phrase, nua, ssip, nh, op, sip, tags);
+ break;
+
case nua_r_authorize:
ssip_r_authorize(status, phrase, nua, ssip, nh, op, sip, tags);
break;
@@ -789,6 +796,63 @@
}
+/* ====================================================================== */
+void ssip_r_publish(int status, char const *phrase, nua_t *nua, ssip_t *ssip,
+ nua_handle_t *nh, ssip_oper_t *op, sip_t const *sip,
+ tagi_t tags[])
+{
+ GaimAccount *account = ssip->s_account;
+ GaimConnection *gc = gaim_account_get_connection(account);
+ char const *username = NULL;
+ char const *passwd = NULL;
+ char *msg;
+
+ enter;
+
+ if (status >= 200 && status < 300) {
+ return;
+ }
+ else if (status == 401 || status == 407) {
+ char const *scheme = NULL;
+ char const *realm = NULL;
+ char *auth = NULL;
+ char *tmp = NULL;
+
+ /* At this point username is formalized (in ssip_login), no regexp needed */
+ username = gaim_account_get_username(account);
+ passwd = gaim_account_get_password(account);
+
+ if (sip && sip->sip_www_authenticate) {
+ scheme = (char const *) sip->sip_www_authenticate->au_scheme;
+ realm = (char const *) *sip->sip_www_authenticate->au_params;
+ }
+ else if (sip && sip->sip_proxy_authenticate) {
+ scheme = (char const *) sip->sip_proxy_authenticate->au_scheme;
+ realm = (char const *) *sip->sip_proxy_authenticate->au_params;
+ }
+
+ tmp = g_strndup(IGNORE_SIP_PREFIX(username), strstr(username, "@") - username - 4);
+
+ auth = g_strdup_printf("%s:%s:%s:%s",
+ scheme, strstr(realm, "=")+1,
+ tmp, passwd);
+ g_free(tmp);
+
+ oper_set_auth(ssip, op, sip, tags);
+ nua_authenticate(op->op_handle, NUTAG_AUTH(auth), TAG_END());
+ g_free(auth);
+ }
+ else {
+ msg = g_strdup_printf("Publication of presence failed: %d %s.\n", status, phrase);
+ gaim_notify_warning(gc, NULL, _("Publication of presence failed."), msg);
+ g_free(msg);
+ ssip_oper_destroy(ssip, op);
+ nua_handle_destroy(nh); /* XXX -- do not try to do anything for some time */
+ }
+ return;
+}
+
+
static void ssip_r_authorize(int status, char const *phrase, nua_t *nua, ssip_t *ssip,
nua_handle_t *nh, ssip_oper_t *op, sip_t const *sip,
tagi_t tags[])
Only in ssip-gst-1.0.0/src: ssip.c~
_______________________________________________
Sofia-sip-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel