hey, ik ben bezig met hottopics voor linux en ik loop tegen een vaag probleem aan:
als je een topic aan de lijst toevoegd:
sync list update de clist, vervolgens word de xml ontcijferd:
en check:
het geeft als output(na het toevoegen van een topic en een update):
de fout zit hem er dus in dat het topicID en de replies niet juist uit de clist gelezen worden EN dat het topicID uit de XML niet goed doorkomt. Als ik in de functie xml_to_topiclist dit zet: printf("%s\n",listItem->id);
staat daar het topicid goed. in het parsen zit het dus niet. dan zit het in het doorgeven van de ene naar de andere functie? maar ik zie niet wat er nou precies fout zit?
is er iemand die me hierbij kan helpen?
als je een topic aan de lijst toevoegd:
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| text = gtk_editable_get_chars((gpointer)entry,50,56); //printf("%s\n",text); topics->id = text; topics->title = NULL; topics->topicstarter = NULL; topics->lastReplier = NULL; topics->replies = NULL; topics->forumshort = NULL; printf("%s\n",topics->id); /* Get the text */ gtk_entry_set_text(GTK_ENTRY(entry), ""); current_topics = g_list_append(current_topics, (gpointer) topics); sync_clist(current_topics); |
sync list update de clist, vervolgens word de xml ontcijferd:
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
| gboolean xml_to_topiclist(char *xmldata, int xmllen) { xmlDocPtr doc; xmlNodePtr root, cur, topic; topicListItem *listItem; topicListItem *newlist3; GList *newtopics = NULL; //GList *current_topics\ = NULL; doc = xmlParseMemory(xmldata, xmllen); <knip> listItem->lastReplier = content; g_free(content); topic = topic->next; } newtopics = g_list_append(newtopics, (gpointer) listItem); g_free(listItem); } cur = cur->next; } xmlFreeDoc(doc); current_topics = topiclist; topiclist = newtopics; newlist3 = (topicListItem *) topiclist; g_list_free(current_topics); g_list_foreach(topiclist, check, NULL); return TRUE; } |
en check:
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
| void check(gpointer element, gpointer data) { <knip> for(row=0;row<rows;row++) { printf("rows: %d\n",rows); gtk_clist_get_text((gpointer) GTK_CLIST(clist),row,0,&topicid); printf("topicid: %d\n",(gint)topicid); gtk_clist_get_text((gpointer)GTK_CLIST(clist),row,4,&replies); printf("Replies: %d\n",(gint)replies); printf("Topicid_new: %d\n",(gint)newlist2->id); if((gint)topicid == (gint) newlist2->id) { printf("topicid hetzeluvde!\n"); if((gint)replies >= 1) { if((gint)replies < (gint)newlist2->replies) { printf("WOEI! nieuwe reply!!!\n"); } } printf("%s/%s/%s/%s/%s/%s\n", newlist2->id, newlist2->title,newlist2->forumshort,newlist2->replies,newlist2->topicstarter,newlist2->lastReplier); topiclist2 = g_list_append(topiclist2, (gpointer) newlist2); sync_clist(topiclist2); } else { printf("nix gevonden :( \n"); printf("%d\n",(gint)(gpointer)topicid); } } return; } |
het geeft als output(na het toevoegen van een topic en een update):
code:
1
2
3
4
5
6
7
| 626254 (het topicid dat is toegevoegd, klopt) 1 (het aantal rijen in de clist) rows: 1 (in functie: check: het aantal rijen: klopt) topicid: 134809784 (topicid: :? :? :? waar ie dit vandaan haalt :?) Replies: 134811120 (hetzelde verhaal :? :? ) Topicid_new: 1080796848 (het topic id dat is uit de xml haalt :?) nix gevonden :( (dat klopt) |
de fout zit hem er dus in dat het topicID en de replies niet juist uit de clist gelezen worden EN dat het topicID uit de XML niet goed doorkomt. Als ik in de functie xml_to_topiclist dit zet: printf("%s\n",listItem->id);
staat daar het topicid goed. in het parsen zit het dus niet. dan zit het in het doorgeven van de ene naar de andere functie? maar ik zie niet wat er nou precies fout zit?
is er iemand die me hierbij kan helpen?