comparison src/buddy.c @ 1235:a9cf2f61a7b1

[gaim-migrate @ 1245] 1. added protocol names to menus in conversation/join chat dialog. helpful if you're signed on as warmenhoven in both irc and yahoo. 2. made "no sounds when away" mean absolutely no sounds when away. 3. fixed buddy pounces and made it so you can save them. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 12 Dec 2000 09:09:24 +0000
parents 728a90516211
children 8cb5c1000ea9
comparison
equal deleted inserted replaced
1234:cedf7047081e 1235:a9cf2f61a7b1
1293 buddy_pounces = g_list_remove(buddy_pounces, b); 1293 buddy_pounces = g_list_remove(buddy_pounces, b);
1294 do_bp_menu(); 1294 do_bp_menu();
1295 save_prefs(); 1295 save_prefs();
1296 } 1296 }
1297 1297
1298 void do_pounce(char *name) 1298 void do_pounce(char *name, int when)
1299 { 1299 {
1300 char *who; 1300 char *who;
1301 1301
1302 struct buddy_pounce *b; 1302 struct buddy_pounce *b;
1303 struct conversation *c; 1303 struct conversation *c;
1309 1309
1310 while(bp) { 1310 while(bp) {
1311 b = (struct buddy_pounce *)bp->data; 1311 b = (struct buddy_pounce *)bp->data;
1312 bp = bp->next; /* increment the list here because rem_bp can make our handle bad */ 1312 bp = bp->next; /* increment the list here because rem_bp can make our handle bad */
1313 1313
1314 if (!(b->options & when)) continue;
1315
1314 u = find_user(b->pouncer, b->protocol); /* find our user */ 1316 u = find_user(b->pouncer, b->protocol); /* find our user */
1315 if (u == NULL) continue; 1317 if (u == NULL) continue;
1316 1318
1317 /* check and see if we're signed on as the pouncer */ 1319 /* check and see if we're signed on as the pouncer */
1318 if (u->gc == NULL) continue; 1320 if (u->gc == NULL) continue;
1319 1321
1320 if (!strcasecmp(who, normalize(b->name))) { /* find someone to pounce */ 1322 if (!strcasecmp(who, normalize(b->name))) { /* find someone to pounce */
1321 if (b->popup == 1) 1323 if (b->options & OPT_POUNCE_POPUP)
1322 { 1324 {
1323 c = find_conversation(name); 1325 c = find_conversation(name);
1324 if (c == NULL) 1326 if (c == NULL)
1325 c = new_conversation(name); 1327 c = new_conversation(name);
1326 } 1328 }
1327 if (b->sendim == 1) 1329 if (b->options & OPT_POUNCE_SEND_IM)
1328 { 1330 {
1329 c = find_conversation(name); 1331 c = find_conversation(name);
1330 if (c == NULL) 1332 if (c == NULL)
1331 c = new_conversation(name); 1333 c = new_conversation(name);
1332 1334
1333 write_to_conv(c, b->message, WFLAG_SEND, NULL); 1335 write_to_conv(c, b->message, WFLAG_SEND, NULL);
1334 serv_send_im(u->gc, name, b->message, 0); 1336 serv_send_im(u->gc, name, b->message, 0);
1335 } 1337 }
1336 if (b->cmd == 1) 1338 if (b->options & OPT_POUNCE_COMMAND)
1337 { 1339 {
1338 int pid = fork(); 1340 int pid = fork();
1339 1341
1340 if (pid == 0) { 1342 if (pid == 0) {
1341 char *args[4]; 1343 char *args[4];
1348 } else if (pid > 0) { 1350 } else if (pid > 0) {
1349 gtk_timeout_add(100, (GtkFunction)clean_pid, NULL); 1351 gtk_timeout_add(100, (GtkFunction)clean_pid, NULL);
1350 } 1352 }
1351 } 1353 }
1352 1354
1353 rem_bp(NULL, b); 1355 if (!(b->options & OPT_POUNCE_SAVE))
1356 rem_bp(NULL, b);
1354 1357
1355 } 1358 }
1356 } 1359 }
1357 g_free(who); 1360 g_free(who);
1358 } 1361 }