| 159 | | // Create osxml doc containing the note |
| 160 | | xmlDoc *doc = xmlNewDoc((const xmlChar*)"1.0"); |
| 161 | | xmlNode *root = osxml_node_add_root(doc, "Note"); |
| 162 | | |
| 163 | | OSyncXMLEncoding enc; |
| 164 | | enc.encoding = OSXML_8BIT; |
| 165 | | enc.charset = OSXML_UTF8; |
| 166 | | |
| 167 | | // Set the right attributes |
| 168 | | xmlNode *sum = xmlNewChild(root, NULL, (const xmlChar*)"", NULL); |
| 169 | | QCString utf8str = i.data().utf8(); |
| 170 | | hash = utf8str; |
| 171 | | osxml_node_set(sum, "Summary", utf8str, enc); |
| 172 | | |
| 173 | | utf8str = strip_html(kn_iface->text(i.key())).utf8(); |
| 174 | | hash += utf8str; |
| 175 | | if (utf8str && !utf8str.isEmpty()) { |
| 176 | | xmlNode *body = xmlNewChild(root, NULL, (const xmlChar*)"", NULL); |
| 177 | | osxml_node_set(body, "Body", utf8str, enc); |
| 178 | | } |
| 179 | | |
| 180 | | // initialize the change object |
| 181 | | OSyncChange *chg = osync_change_new(); |
| 182 | | osync_change_set_uid(chg, uid.local8Bit()); |
| 183 | | osync_change_set_member(chg, member); |
| 184 | | |
| 185 | | // object type and format |
| 186 | | osync_change_set_objtype_string(chg, "note"); |
| 187 | | osync_change_set_objformat_string(chg, "xml-note"); |
| 188 | | osync_change_set_data(chg, (char*)doc, sizeof(doc), 1); |
| | 167 | // Create osxml doc containing the note |
| | 168 | xmlDoc *doc = xmlNewDoc((const xmlChar*)"1.0"); |
| | 169 | xmlNode *root = osxml_node_add_root(doc, "Note"); |
| | 170 | |
| | 171 | OSyncXMLEncoding enc; |
| | 172 | enc.encoding = OSXML_8BIT; |
| | 173 | enc.charset = OSXML_UTF8; |
| | 174 | |
| | 175 | // Set the right attributes |
| | 176 | xmlNode *sum = xmlNewChild(root, NULL, (const xmlChar*)"", NULL); |
| | 177 | QCString utf8str = i.data().utf8(); |
| | 178 | hash = utf8str; |
| | 179 | osxml_node_set(sum, "Summary", utf8str, enc); |
| | 180 | |
| | 181 | utf8str = strip_html(kn_iface->text(i.key())).utf8(); |
| | 182 | hash += utf8str; |
| | 183 | if (utf8str && !utf8str.isEmpty()) { |
| | 184 | xmlNode *body = xmlNewChild(root, NULL, (const xmlChar*)"", NULL); |
| | 185 | osxml_node_set(body, "Body", utf8str, enc); |
| | 186 | } |
| | 187 | |
| | 188 | // initialize the change object |
| | 189 | OSyncChange *chg = osync_change_new(); |
| | 190 | osync_change_set_uid(chg, uid.local8Bit()); |
| | 191 | osync_change_set_member(chg, member); |
| | 192 | |
| | 193 | // object type and format |
| | 194 | osync_change_set_objtype_string(chg, "note"); |
| | 195 | osync_change_set_objformat_string(chg, "xml-note"); |
| | 196 | osync_change_set_data(chg, (char*)doc, sizeof(doc), 1); |
| 192 | | // Use the hash table to check if the object |
| 193 | | // needs to be reported |
| 194 | | osync_change_set_hash(chg, hash.data()); |
| 195 | | if (osync_hashtable_detect_change(hashtable, chg)) { |
| 196 | | osync_context_report_change(ctx, chg); |
| 197 | | osync_hashtable_update_hash(hashtable, chg); |
| 198 | | } |
| 199 | | } |
| 200 | | |
| 201 | | osync_hashtable_report_deleted(hashtable, ctx, "note"); |
| 202 | | |
| 203 | | osync_trace(TRACE_EXIT, "%s", __func__); |
| 204 | | return true; |
| | 200 | // Use the hash table to check if the object |
| | 201 | // needs to be reported |
| | 202 | osync_change_set_hash(chg, hash.data()); |
| | 203 | if (osync_hashtable_detect_change(hashtable, chg)) { |
| | 204 | osync_context_report_change(ctx, chg); |
| | 205 | osync_hashtable_update_hash(hashtable, chg); |
| | 206 | } |
| | 207 | } |
| | 208 | |
| | 209 | osync_hashtable_report_deleted(hashtable, ctx, "note"); |
| | 210 | |
| | 211 | osync_trace(TRACE_EXIT, "%s", __func__); |
| | 212 | return true; |