Mercurial > pidgin
comparison src/sound.c @ 3060:4f2f12bf4408
[gaim-migrate @ 3074]
Code cleanups by Robert McQueen. Michael Golden replaced the multiple per-account signon windows with a single signon window showing the status of all your accounts
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Sat, 16 Mar 2002 00:32:53 +0000 |
parents | 0486d3d00d0e |
children | 359b4cd0e766 |
comparison
equal
deleted
inserted
replaced
3059:966c4e460ebb | 3060:4f2f12bf4408 |
---|---|
50 #include "sounds/BuddyLeave.h" | 50 #include "sounds/BuddyLeave.h" |
51 #include "sounds/Send.h" | 51 #include "sounds/Send.h" |
52 #include "sounds/Receive.h" | 52 #include "sounds/Receive.h" |
53 #include "sounds/RedAlert.h" | 53 #include "sounds/RedAlert.h" |
54 | 54 |
55 /* label and opt are null for the buddy pounce because it's configured * | |
56 * per pounce. NULL option means it doesn't get displayed in the sound * | |
57 * preferences box */ | |
58 struct sound_struct sounds[NUM_SOUNDS] = { | |
59 N_("Buddy logs in"), OPT_SOUND_LOGIN, BuddyArrive, sizeof(BuddyArrive), | |
60 N_("Buddy logs out"), OPT_SOUND_LOGOUT, BuddyLeave, sizeof(BuddyLeave), | |
61 N_("Message recieved begins conversation"), OPT_SOUND_FIRST_RCV, Receive, sizeof(Receive), | |
62 N_("Message recieved"), OPT_SOUND_RECV, Receive, sizeof(Receive), | |
63 N_("Message sent"), OPT_SOUND_SEND, Send, sizeof(Send), | |
64 N_("Person enters chat"), OPT_SOUND_CHAT_JOIN, BuddyArrive, sizeof(BuddyArrive), | |
65 N_("Person leaves chat"), OPT_SOUND_CHAT_PART, BuddyLeave, sizeof(BuddyLeave), | |
66 N_("You talk in chat"), OPT_SOUND_CHAT_YOU_SAY, Send, sizeof(Send), | |
67 N_("Others talk in chat"), OPT_SOUND_CHAT_SAY, Receive, sizeof(Receive), | |
68 NULL, NULL, &RedAlert, sizeof(RedAlert) | |
69 }; | |
70 | |
55 static int check_dev(char *dev) | 71 static int check_dev(char *dev) |
56 { | 72 { |
57 struct stat stat_buf; | 73 struct stat stat_buf; |
58 uid_t user = getuid(); | 74 uid_t user = getuid(); |
59 gid_t group = getgid(), other_groups[32]; | 75 gid_t group = getgid(), other_groups[32]; |
394 if (sound_options & OPT_SOUND_BEEP) { | 410 if (sound_options & OPT_SOUND_BEEP) { |
395 gdk_beep(); | 411 gdk_beep(); |
396 return; | 412 return; |
397 } | 413 } |
398 | 414 |
415 else if (sound_options & OPT_SOUND_NORMAL) { | |
416 debug_printf("attempting to play audio file with internal method -- this is unlikely to work"); | |
417 } | |
418 | |
399 pid = fork(); | 419 pid = fork(); |
400 | 420 |
401 if (pid < 0) | 421 if (pid < 0) |
402 return; | 422 return; |
403 else if (pid == 0) { | 423 else if (pid == 0) { |
520 | 540 |
521 extern int logins_not_muted; | 541 extern int logins_not_muted; |
522 | 542 |
523 void play_sound(int sound) | 543 void play_sound(int sound) |
524 { | 544 { |
525 | |
526 if (awaymessage && !(sound_options & OPT_SOUND_WHEN_AWAY)) | 545 if (awaymessage && !(sound_options & OPT_SOUND_WHEN_AWAY)) |
527 return; | 546 return; |
528 | 547 |
529 switch (sound) { | 548 if ((sound == SND_BUDDY_ARRIVE) && !logins_not_muted) |
530 case BUDDY_ARRIVE: | 549 return; |
531 if ((sound_options & OPT_SOUND_LOGIN) && logins_not_muted) { | 550 |
532 if (sound_file[BUDDY_ARRIVE]) { | 551 if (sound >= NUM_SOUNDS) { |
533 play_file(sound_file[BUDDY_ARRIVE]); | 552 debug_printf("sorry old fruit... can't say I know that sound: ", sound); |
534 } else { | 553 return; |
535 play(BuddyArrive, sizeof(BuddyArrive)); | 554 } |
536 } | 555 |
537 } | 556 /* check NULL for sounds that don't have an option, ie buddy pounce */ |
538 break; | 557 if ((sound_options & sounds[sound].opt) || (sounds[sound].opt == NULL)) { |
539 case BUDDY_LEAVE: | 558 if (sound_file[sound]) { |
540 if (sound_options & OPT_SOUND_LOGOUT) { | 559 play_file(sound_file[sound]); |
541 if (sound_file[BUDDY_LEAVE]) { | |
542 play_file(sound_file[BUDDY_LEAVE]); | |
543 } else { | |
544 play(BuddyLeave, sizeof(BuddyLeave)); | |
545 } | |
546 } | |
547 break; | |
548 case FIRST_RECEIVE: | |
549 if (sound_options & OPT_SOUND_FIRST_RCV) { | |
550 if (sound_file[FIRST_RECEIVE]) { | |
551 play_file(sound_file[FIRST_RECEIVE]); | |
552 } else { | |
553 play(Receive, sizeof(Receive)); | |
554 } | |
555 } | |
556 break; | |
557 case RECEIVE: | |
558 if (sound_options & OPT_SOUND_RECV) { | |
559 if (sound_file[RECEIVE]) { | |
560 play_file(sound_file[RECEIVE]); | |
561 } else { | |
562 play(Receive, sizeof(Receive)); | |
563 } | |
564 } | |
565 break; | |
566 case SEND: | |
567 if (sound_options & OPT_SOUND_SEND) { | |
568 if (sound_file[SEND]) { | |
569 play_file(sound_file[SEND]); | |
570 } else { | |
571 play(Send, sizeof(Send)); | |
572 } | |
573 } | |
574 break; | |
575 case CHAT_JOIN: | |
576 if (sound_options & OPT_SOUND_CHAT_JOIN) { | |
577 if (sound_file[CHAT_JOIN]) { | |
578 play_file(sound_file[CHAT_JOIN]); | |
579 } else { | |
580 play(BuddyArrive, sizeof(BuddyArrive)); | |
581 } | |
582 } | |
583 break; | |
584 case CHAT_LEAVE: | |
585 if (sound_options & OPT_SOUND_CHAT_PART) { | |
586 if (sound_file[CHAT_LEAVE]) { | |
587 play_file(sound_file[CHAT_LEAVE]); | |
588 } else { | |
589 play(BuddyLeave, sizeof(BuddyLeave)); | |
590 } | |
591 } | |
592 break; | |
593 case CHAT_YOU_SAY: | |
594 if (sound_options & OPT_SOUND_CHAT_YOU_SAY) { | |
595 if (sound_file[CHAT_YOU_SAY]) { | |
596 play_file(sound_file[CHAT_YOU_SAY]); | |
597 } else { | |
598 play(Send, sizeof(Send)); | |
599 } | |
600 } | |
601 break; | |
602 case CHAT_SAY: | |
603 if (sound_options & OPT_SOUND_CHAT_SAY) { | |
604 if (sound_file[CHAT_SAY]) { | |
605 play_file(sound_file[CHAT_SAY]); | |
606 } else { | |
607 play(Receive, sizeof(Receive)); | |
608 } | |
609 } | |
610 break; | |
611 case POUNCE_DEFAULT: | |
612 if (sound_file[POUNCE_DEFAULT]) { | |
613 play_file(sound_file[POUNCE_DEFAULT]); | |
614 } else { | 560 } else { |
615 play(RedAlert, sizeof(RedAlert)); | 561 play(sounds[sound].snd, sounds[sound].snd_size); |
616 } | 562 } |
617 break; | 563 } |
618 } | 564 } |
619 } |