Browse code

pua: update_version_puadb() use pres_id to select record

* only relevant when db_mode is PUA_DB_ONLY
* call_id/to_tag/from_tag values can be "", for instance with
DIALOG_PUBLISH.* records. Then **ALL** records get version
field update
* update_vesion_puadb() is called from send_publish() and pres->id
value is valid after a call to get_record_puadb()

related to #2414

Victor Seva authored on 31/07/2020 14:00:06
Showing 1 changed files
... ...
@@ -1485,8 +1485,8 @@ int update_contact_puadb(ua_pres_t *pres, str *contact)
1485 1485
 int update_version_puadb(ua_pres_t *pres)
1486 1486
 
1487 1487
 {
1488
-	db_key_t q_cols[3], db_cols[1];
1489
-	db_val_t q_vals[3], db_vals[1];
1488
+	db_key_t q_cols[1], db_cols[1];
1489
+	db_val_t q_vals[1], db_vals[1];
1490 1490
 	int n_query_cols= 0, n_update_cols=0;
1491 1491
 
1492 1492
 	if (pres==NULL)
... ...
@@ -1496,22 +1496,10 @@ int update_version_puadb(ua_pres_t *pres)
1496 1496
 	}
1497 1497
 
1498 1498
 	/* cols and values used for search query */
1499
-	q_cols[n_query_cols] = &str_call_id_col;
1500
-	q_vals[n_query_cols].type = DB1_STR;
1501
-	q_vals[n_query_cols].nul = 0;
1502
-	q_vals[n_query_cols].val.str_val = pres->call_id;
1503
-	n_query_cols++;
1504
-
1505
-	q_cols[n_query_cols] = &str_to_tag_col;
1506
-	q_vals[n_query_cols].type = DB1_STR;
1507
-	q_vals[n_query_cols].nul = 0;
1508
-	q_vals[n_query_cols].val.str_val = pres->to_tag;
1509
-	n_query_cols++;
1510
-
1511
-	q_cols[n_query_cols] = &str_from_tag_col;
1499
+	q_cols[n_query_cols] = &str_pres_id_col;
1512 1500
 	q_vals[n_query_cols].type = DB1_STR;
1513 1501
 	q_vals[n_query_cols].nul = 0;
1514
-	q_vals[n_query_cols].val.str_val = pres->from_tag;
1502
+	q_vals[n_query_cols].val.str_val = pres->id;
1515 1503
 	n_query_cols++;
1516 1504
 
1517 1505
 	/* we overwrite contact even if not changed */