comparison src/protocols/irc/msgs.c @ 9741:b10d4c6ac7eb

[gaim-migrate @ 10606] (20:26:58) KingAnt: LSchiere: Can you revert it and I'll post some suggestions to the patch in the tracker? committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Thu, 12 Aug 2004 00:26:28 +0000
parents 2bb5e2cd64bd
children 3f97624e7753
comparison
equal deleted inserted replaced
9740:2bb5e2cd64bd 9741:b10d4c6ac7eb
26 #include "blist.h" 26 #include "blist.h"
27 #include "notify.h" 27 #include "notify.h"
28 #include "util.h" 28 #include "util.h"
29 #include "debug.h" 29 #include "debug.h"
30 #include "irc.h" 30 #include "irc.h"
31 #include "privacy.h"
32 31
33 #include <stdio.h> 32 #include <stdio.h>
34 33
35 static char *irc_mask_nick(const char *mask); 34 static char *irc_mask_nick(const char *mask);
36 static char *irc_mask_userhost(const char *mask); 35 static char *irc_mask_userhost(const char *mask);
845 { 844 {
846 GaimConnection *gc = gaim_account_get_connection(irc->account); 845 GaimConnection *gc = gaim_account_get_connection(irc->account);
847 GaimConversation *convo; 846 GaimConversation *convo;
848 char *nick = irc_mask_nick(from), *tmp, *msg; 847 char *nick = irc_mask_nick(from), *tmp, *msg;
849 int notice = 0; 848 int notice = 0;
850 GSList* l;
851 gboolean in_deny=0;
852 849
853 if (!args || !args[0] || !args[1] || !gc) { 850 if (!args || !args[0] || !args[1] || !gc) {
854 g_free(nick); 851 g_free(nick);
855 return; 852 return;
856 } 853 }
860 if (!tmp) { 857 if (!tmp) {
861 g_free(nick); 858 g_free(nick);
862 return; 859 return;
863 } 860 }
864 861
865
866 switch (gc->account->perm_deny) {
867 case GAIM_PRIVACY_ALLOW_ALL:
868 in_deny = 0; break;
869 case GAIM_PRIVACY_DENY_ALL:
870 in_deny = 1; break;
871 case GAIM_PRIVACY_ALLOW_USERS: /* See if stripped_sender is in gc->account->permit and allow appropriately */
872 in_deny = 1;
873 for(l=gc->account->permit;l!=NULL;l=l->next) {
874 if (!gaim_utf8_strcasecmp(nick, gaim_normalize(gc->account, (char *)l->data))) {
875 in_deny=0;
876 break;
877 }
878 }
879 break;
880 case GAIM_PRIVACY_DENY_USERS: /* See if nick is in gc->account->deny and deny if so */
881 in_deny = 0;
882 for(l=gc->account->deny;l!=NULL;l=l->next) {
883 if (!gaim_utf8_strcasecmp(nick, gaim_normalize(gc->account, (char *)l->data))) {
884 in_deny=1;
885 break;
886 }
887 }
888 break;
889 case GAIM_PRIVACY_ALLOW_BUDDYLIST:
890 in_deny = 1;
891 if (gaim_find_buddy(gc->account,nick)!=NULL) {
892 in_deny = 0;
893 }
894 break;
895 default:
896 in_deny=0; break;
897 }
898
899 msg = gaim_escape_html(tmp); 862 msg = gaim_escape_html(tmp);
900 g_free(tmp); 863 g_free(tmp);
901 864
902 tmp = irc_mirc2html(msg); 865 tmp = irc_mirc2html(msg);
903 g_free(msg); 866 g_free(msg);
907 g_free(msg); 870 g_free(msg);
908 msg = tmp; 871 msg = tmp;
909 } 872 }
910 873
911 if (!gaim_utf8_strcasecmp(args[0], gaim_connection_get_display_name(gc))) { 874 if (!gaim_utf8_strcasecmp(args[0], gaim_connection_get_display_name(gc))) {
912 if (!in_deny) {
913 serv_got_im(gc, nick, msg, 0, time(NULL)); 875 serv_got_im(gc, nick, msg, 0, time(NULL));
914 }
915 } else if (notice) { 876 } else if (notice) {
916 if(!in_deny) {
917 serv_got_im(gc, nick, msg, 0, time(NULL)); 877 serv_got_im(gc, nick, msg, 0, time(NULL));
918 }
919 } else { 878 } else {
920 convo = gaim_find_conversation_with_account(args[0], irc->account); 879 convo = gaim_find_conversation_with_account(args[0], irc->account);
921 if (convo) 880 if (convo)
922 serv_got_chat_in(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(convo)), nick, 0, msg, time(NULL)); 881 serv_got_chat_in(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(convo)), nick, 0, msg, time(NULL));
923 else 882 else