Mercurial > pidgin
comparison libpurple/protocols/oscar/family_feedbag.c @ 16468:79c5daa011a2
Clean up a wee bit of oscar code. No functionality change.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 25 Apr 2007 06:11:35 +0000 |
parents | 9326d4cf5497 |
children | f7466b0379e8 |
comparison
equal
deleted
inserted
replaced
16411:569eba287c84 | 16468:79c5daa011a2 |
---|---|
110 * @param data The additional data for the new item. | 110 * @param data The additional data for the new item. |
111 * @return A pointer to the newly created item. | 111 * @return A pointer to the newly created item. |
112 */ | 112 */ |
113 static struct aim_ssi_item *aim_ssi_itemlist_add(struct aim_ssi_item **list, const char *name, guint16 gid, guint16 bid, guint16 type, aim_tlvlist_t *data) | 113 static struct aim_ssi_item *aim_ssi_itemlist_add(struct aim_ssi_item **list, const char *name, guint16 gid, guint16 bid, guint16 type, aim_tlvlist_t *data) |
114 { | 114 { |
115 int i; | 115 gboolean exists; |
116 struct aim_ssi_item *cur, *new; | 116 struct aim_ssi_item *cur, *new; |
117 | 117 |
118 new = (struct aim_ssi_item *)malloc(sizeof(struct aim_ssi_item)); | 118 new = (struct aim_ssi_item *)malloc(sizeof(struct aim_ssi_item)); |
119 | 119 |
120 /* Set the name */ | 120 /* Set the name */ |
129 new->bid = bid; | 129 new->bid = bid; |
130 if (type == AIM_SSI_TYPE_GROUP) { | 130 if (type == AIM_SSI_TYPE_GROUP) { |
131 if ((new->gid == 0xFFFF) && name) { | 131 if ((new->gid == 0xFFFF) && name) { |
132 do { | 132 do { |
133 new->gid += 0x0001; | 133 new->gid += 0x0001; |
134 for (cur=*list, i=0; ((cur) && (!i)); cur=cur->next) | 134 exists = FALSE; |
135 for (cur = *list; cur != NULL; cur = cur->next) | |
135 if ((cur->type == AIM_SSI_TYPE_GROUP) && (cur->gid == new->gid)) { | 136 if ((cur->type == AIM_SSI_TYPE_GROUP) && (cur->gid == new->gid)) { |
136 i=1; | 137 exists = TRUE; |
137 break; | 138 break; |
138 } | 139 } |
139 } while (i); | 140 } while (exists); |
140 } | 141 } |
141 } else if (new->gid == 0x0000) { | 142 } else if (new->gid == 0x0000) { |
142 if (new->bid == 0xFFFF) { | 143 if (new->bid == 0xFFFF) { |
143 do { | 144 do { |
144 new->bid += 0x0001; | 145 new->bid += 0x0001; |
145 for (cur=*list, i=0; ((cur) && (!i)); cur=cur->next) | 146 exists = FALSE; |
147 for (cur = *list; cur != NULL; cur = cur->next) | |
146 if (((cur->bid == new->bid) && (cur->gid == new->gid)) || (cur->gid == new->bid)) { | 148 if (((cur->bid == new->bid) && (cur->gid == new->gid)) || (cur->gid == new->bid)) { |
147 i=1; | 149 exists = TRUE; |
148 break; | 150 break; |
149 } | 151 } |
150 } while (i); | 152 } while (exists); |
151 } | 153 } |
152 } else { | 154 } else { |
153 if (new->bid == 0xFFFF) { | 155 if (new->bid == 0xFFFF) { |
154 do { | 156 do { |
155 new->bid += 0x0001; | 157 new->bid += 0x0001; |
156 for (cur=*list, i=0; ((cur) && (!i)); cur=cur->next) | 158 exists = FALSE; |
159 for (cur = *list; cur != NULL; cur = cur->next) | |
157 if ((cur->bid == new->bid) && (cur->gid == new->gid)) { | 160 if ((cur->bid == new->bid) && (cur->gid == new->gid)) { |
158 i=1; | 161 exists = TRUE; |
159 break; | 162 break; |
160 } | 163 } |
161 } while (i); | 164 } while (exists); |
162 } | 165 } |
163 } | 166 } |
164 | 167 |
165 /* Set the type */ | 168 /* Set the type */ |
166 new->type = type; | 169 new->type = type; |