- if(flags)
- {
- if(!IsCapable(source_p, clicap_list[i].cap_serv))
- continue;
- /* they are capable of this, check sticky */
- else if(clear && clicap_list[i].flags & CLICAP_FLAGS_STICKY)
- continue;
- }
+ size_t caplen = 0;
+ struct ClientCapability *clicap = entry->ownerdata;
+ const char *data = NULL;
+
+ if(flags && !IsCapableEntry(source_p, entry))
+ continue;
+
+ if (!clicap_visible(source_p, entry))
+ continue;
+
+ caplen = strlen(entry->cap);
+ if (!flags && (source_p->flags & FLAGS_CLICAP_DATA) && clicap != NULL && clicap->data != NULL)
+ data = clicap->data(source_p);
+
+ if (data != NULL)
+ caplen += strlen(data) + 1;