there is no particular reason to use "deleted" for subs.reason, just to remind us. So it should be safe to not use "deleted" subs.reason.<br><br>Yes the status==1 is checked for ACTIVE_STATUS. It's better to use ACTIVE_STATUS instead of 1 as you suggested.<br>
<br>Thx.<br><br>Best Regards,<br>Laura<br><br><div class="gmail_quote">On Wed, Jul 6, 2011 at 7:02 PM, Daniel-Constantin Mierla <span dir="ltr"><<a href="mailto:miconda@gmail.com">miconda@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div bgcolor="#FFFFFF" text="#000000">
Hello,<br>
<br>
any reason to use "deleted" for subs.reason?<br>
<br>
Also, (status==1) condition is supposed to check for ACTIVE_STATUS?<br>
<br>
I adapted a bit your patch based on available defines/functions --
see it next and let me know if your was intended to behave
differently. If all ok, I will commit to devel and backport to
3.1.x.<br>
<br>
# git diff<br>
<br>
diff --git a/modules_k/presence/presence.c
b/modules_k/presence/presence.c<br>
index df1a4ac..e97df6c 100644<br>
--- a/modules_k/presence/presence.c<br>
+++ b/modules_k/presence/presence.c<br>
@@ -728,6 +728,14 @@ int pres_update_status(subs_t subs, str reason,
db_key_t* q<div class="im"><br>
query_vals[q_wuser_col].val.str_val= subs.from_user;
<br>
query_vals[q_wdomain_col].val.str_val=
subs.from_domain; <br>
<br></div>
+ /* if status is no longer ACTIVE, switch to
terminated */<br>
+ if(subs.status!=status &&
status==ACTIVE_STATUS)<br>
+ {<br>
+ subs.status = TERMINATED_STATUS;<br>
+ subs.reason.s =
get_status_str(TERMINATED_STATUS);<br>
+ subs.reason.len = strlen(subs.reason.s);<br>
+ }<br>
+<br>
update_vals[u_status_col].val.int_val= subs.status;<br>
update_vals[u_reason_col].val.str_val= subs.reason;<br>
<br>
<br>
Cheers,<br>
Daniel<div><div></div><div class="h5"><br>
<br>
On 7/6/11 3:39 PM, laura testi wrote:
</div></div><blockquote type="cite"><div><div></div><div class="h5">It's for v3.1.4. But I think the problem is also in
devel.<br>
<br>
# diff -u presence.c.orig presence.c.patch<br>
------ cut here ---------------<br>
--- presence.c.orig 2011-06-10 15:35:49.000000000 +0200<br>
+++ presence.c.patch 2011-06-17 18:44:05.000000000 +0200<br>
@@ -712,6 +712,13 @@<br>
(reason.s && subs.reason.s &&
strncmp(reason.s, subs.reason.s,<br>
reason.len)))<br>
{<br>
+ if(subs.status!=status && status==1)<br>
+ {<br>
+ subs.status= TERMINATED_STATUS;<br>
+ subs.reason.s= "deleted";<br>
+ subs.reason.len= 7;<br>
+ }<br>
+<br>
/* update in watchers_table */<br>
query_vals[q_wuser_col].val.str_val=
subs.from_user;<br>
query_vals[q_wdomain_col].val.str_val=
subs.from_domain;<br>
--------- end cut ------------------------------<br>
#<br>
<br>
<br>
<br>
<br>
<br>
<div class="gmail_quote">On Wed, Jul 6, 2011 at 2:23 PM,
sip-router <span dir="ltr"><<a href="mailto:admin@sip-router.org" target="_blank">admin@sip-router.org</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.<br>
<br>
The following task has a new comment added:<br>
<br>
FS#133 - kamailio 3.1.3 Presence + XCAP problem, is it a
bug?<br>
User who did this - Daniel-Constantin Mierla (miconda)<br>
<br>
----------<br>
</div>
Can you send the unified diff, ie., taken as:<br>
<br>
diff -u presence.c.orig presence.c.patch<br>
<br>
Is it for v3.1.x or devel?
<div><br>
----------<br>
<br>
More information can be found at the following URL:<br>
</div>
<a href="http://sip-router.org/tracker/index.php?do=details&task_id=133#comment235" target="_blank">http://sip-router.org/tracker/index.php?do=details&task_id=133#comment235</a>
<div>
<div><br>
<br>
You are receiving this message because you have requested
it from the Flyspray bugtracking system. If you did not
expect this message or don't want to receive mails in
future, you can change your notification settings at the
URL shown above.<br>
</div>
</div>
</blockquote>
</div>
<br>
<br>
<fieldset></fieldset>
<br>
</div></div><pre>_______________________________________________
sr-dev mailing list
<a href="mailto:sr-dev@lists.sip-router.org" target="_blank">sr-dev@lists.sip-router.org</a>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a>
</pre>
</blockquote>
<br>
<pre cols="72">--
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
Kamailio Advanced Training, Oct 10-13, Berlin: <a href="http://asipto.com/u/kat" target="_blank">http://asipto.com/u/kat</a>
<a href="http://linkedin.com/in/miconda" target="_blank">http://linkedin.com/in/miconda</a> -- <a href="http://twitter.com/miconda" target="_blank">http://twitter.com/miconda</a></pre>
</div>
</blockquote></div><br>