Browse code

* Fixed bug in computing expires value for subscription dialogs. Credits to Anca Vamanu.

Juha Heinanen authored on 11/05/2009 11:15:12
Showing 1 changed files
... ...
@@ -1096,14 +1096,14 @@ int get_subs_db(str* pres_uri, pres_ev_t* event, str* sender,
1096 1096
 		row = &result->rows[i];
1097 1097
 		row_vals = ROW_VALUES(row);	
1098 1098
 		
1099
-	//	if(row_vals[expires_col].val.int_val< (int)time(NULL))
1100
-	//		continue;
1101
-
1102
-        if(row_vals[reason_col].val.string_val)
1103
-        {
1104
-            if(strlen(row_vals[reason_col].val.string_val) != 0)
1105
-                continue;
1106
-        }
1099
+		//	if(row_vals[expires_col].val.int_val< (int)time(NULL))
1100
+		//		continue;
1101
+
1102
+		if(row_vals[reason_col].val.string_val) {
1103
+		    if(strlen(row_vals[reason_col].val.string_val) != 0)
1104
+			continue;
1105
+		}
1106
+
1107 1107
 		//	s.reason.len= strlen(s.reason.s);
1108 1108
 
1109 1109
 		memset(&s, 0, sizeof(subs_t));
... ...
@@ -1148,7 +1148,11 @@ int get_subs_db(str* pres_uri, pres_ev_t* event, str* sender,
1148 1148
 		
1149 1149
 		s.event= event;
1150 1150
 		s.local_cseq = row_vals[cseq_col].val.int_val;
1151
-		s.expires = row_vals[expires_col].val.int_val -(int)time(NULL);
1151
+		if(row_vals[expires_col].val.int_val < (int)time(NULL))
1152
+		    s.expires = 0;
1153
+		else
1154
+		    s.expires = row_vals[expires_col].val.int_val -
1155
+			(int)time(NULL);
1152 1156
 		s.version = row_vals[version_col].val.int_val;
1153 1157
 
1154 1158
 		s_new= mem_copy_subs(&s, PKG_MEM_TYPE);