comparison src/protocols/trepia/trepia.c @ 5731:7cb2bbf03db5

[gaim-migrate @ 6155] Part of user profiles now appears in the tooltip and under the username. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Wed, 04 Jun 2003 04:52:45 +0000
parents 99ae9bd8b5fa
children 37810936887e
comparison
equal deleted inserted replaced
5730:99ae9bd8b5fa 5731:7cb2bbf03db5
172 } 172 }
173 173
174 static char * 174 static char *
175 trepia_status_text(struct buddy *b) 175 trepia_status_text(struct buddy *b)
176 { 176 {
177 TrepiaProfile *profile = (TrepiaProfile *)b->proto_data;
178
179 if (trepia_profile_get_profile(profile) != NULL)
180 return g_strdup(trepia_profile_get_profile(profile));
181
177 return NULL; 182 return NULL;
178 } 183 }
179 184
180 static char * 185 static char *
181 trepia_tooltip_text(struct buddy *b) 186 trepia_tooltip_text(struct buddy *b)
182 { 187 {
183 return NULL; 188 TrepiaProfile *profile = (TrepiaProfile *)b->proto_data;
189 const char *value;
190 const char *first_name, *last_name;
191 int int_value;
192 char *text = NULL;
193 char *tmp, *tmp2;
194 char *c;
195
196 text = g_strdup("");
197
198 first_name = trepia_profile_get_first_name(profile);
199 last_name = trepia_profile_get_last_name(profile);
200
201 if (first_name != NULL || last_name != NULL) {
202 tmp = g_strdup_printf("<b>Name:</b> %s%s%s\n",
203 (first_name == NULL ? "" : first_name),
204 (first_name == NULL ? "" : " "),
205 (last_name == NULL ? "" : last_name));
206
207 tmp2 = g_strconcat(text, tmp, NULL);
208 g_free(tmp);
209 g_free(text);
210 text = tmp2;
211 }
212
213 if ((int_value = trepia_profile_get_age(profile)) != 0) {
214 tmp = g_strdup_printf("<b>Age:</b> %d\n", int_value);
215
216 tmp2 = g_strconcat(text, tmp, NULL);
217 g_free(tmp);
218 g_free(text);
219 text = tmp2;
220 }
221
222 tmp = g_strdup_printf("<b>Gender:</b> %s\n",
223 (trepia_profile_get_sex(profile) == 'F' ? "Female" : "Male"));
224
225 tmp2 = g_strconcat(text, tmp, NULL);
226 g_free(tmp);
227 g_free(text);
228 text = tmp2;
229
230 if ((value = trepia_profile_get_city(profile)) != NULL) {
231 tmp = g_strdup_printf("<b>City:</b> %s\n", value);
232
233 tmp2 = g_strconcat(text, tmp, NULL);
234 g_free(tmp);
235 g_free(text);
236 text = tmp2;
237 }
238
239 if ((value = trepia_profile_get_state(profile)) != NULL) {
240 tmp = g_strdup_printf("<b>State:</b> %s\n", value);
241
242 tmp2 = g_strconcat(text, tmp, NULL);
243 g_free(tmp);
244 g_free(text);
245 text = tmp2;
246 }
247
248 if ((value = trepia_profile_get_country(profile)) != NULL) {
249 tmp = g_strdup_printf("<b>Country:</b> %s\n", value);
250
251 tmp2 = g_strconcat(text, tmp, NULL);
252 g_free(tmp);
253 g_free(text);
254 text = tmp2;
255 }
256
257 c = text + strlen(text);
258
259 if (*c == '\n')
260 *c = '\0';
261
262 return text;
184 } 263 }
185 264
186 static GList * 265 static GList *
187 trepia_away_states(GaimConnection *gc) 266 trepia_away_states(GaimConnection *gc)
188 { 267 {
782 OPT_PROTO_BUDDY_ICON, 861 OPT_PROTO_BUDDY_ICON,
783 NULL, 862 NULL,
784 NULL, 863 NULL,
785 trepia_list_icon, 864 trepia_list_icon,
786 trepia_list_emblems, 865 trepia_list_emblems,
787 NULL, 866 trepia_status_text,
788 trepia_tooltip_text, 867 trepia_tooltip_text,
789 NULL, 868 NULL,
790 NULL, 869 NULL,
791 NULL, 870 NULL,
792 NULL, 871 NULL,