Mercurial > pidgin
comparison src/toc.c @ 1145:cd96ca1aed02
[gaim-migrate @ 1155]
actually to be quite honest toc has been blocking me so i have no way of knowing that the permit/deny stuff that i'm committing actually works. but i'm sure i'll get a bug report in about 3 hours or so if it's not.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Mon, 27 Nov 2000 13:18:11 +0000 |
parents | 028295b1f1b3 |
children | 22f3c32a28f6 |
comparison
equal
deleted
inserted
replaced
1144:b1454d019277 | 1145:cd96ca1aed02 |
---|---|
45 #include "pixmaps/aol_icon.xpm" | 45 #include "pixmaps/aol_icon.xpm" |
46 #include "pixmaps/away_icon.xpm" | 46 #include "pixmaps/away_icon.xpm" |
47 #include "pixmaps/dt_icon.xpm" | 47 #include "pixmaps/dt_icon.xpm" |
48 #include "pixmaps/free_icon.xpm" | 48 #include "pixmaps/free_icon.xpm" |
49 | 49 |
50 #define REVISION "gaim:$Revision: 1142 $" | 50 #define REVISION "gaim:$Revision: 1155 $" |
51 | 51 |
52 #define TYPE_SIGNON 1 | 52 #define TYPE_SIGNON 1 |
53 #define TYPE_DATA 2 | 53 #define TYPE_DATA 2 |
54 #define TYPE_ERROR 3 | 54 #define TYPE_ERROR 3 |
55 #define TYPE_SIGNOFF 4 | 55 #define TYPE_SIGNOFF 4 |
1103 gtk_widget_show(opt); | 1103 gtk_widget_show(opt); |
1104 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_HTTP) | 1104 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_HTTP) |
1105 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); | 1105 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); |
1106 } | 1106 } |
1107 | 1107 |
1108 static void toc_add_permit(struct gaim_connection *gc, char *who) { | |
1109 char buf2[MSG_LEN]; | |
1110 if (gc->permdeny != 3) return; | |
1111 g_snprintf(buf2, sizeof(buf2), "toc_add_permit %s", normalize(who)); | |
1112 sflap_send(gc, buf2, -1, TYPE_DATA); | |
1113 } | |
1114 | |
1115 static void toc_add_deny(struct gaim_connection *gc, char *who) { | |
1116 char buf2[MSG_LEN]; | |
1117 if (gc->permdeny != 4) return; | |
1118 g_snprintf(buf2, sizeof(buf2), "toc_add_permit %s", normalize(who)); | |
1119 sflap_send(gc, buf2, -1, TYPE_DATA); | |
1120 } | |
1121 | |
1122 static void toc_set_permit_deny(struct gaim_connection *gc) { | |
1123 char buf2[MSG_LEN]; | |
1124 GSList *list; | |
1125 int at; | |
1126 | |
1127 switch (gc->permdeny) { | |
1128 case 1: | |
1129 /* permit all, deny none. to get here reliably we need to have been in permit | |
1130 * mode, and send an empty toc_add_deny message, which will switch us to deny none */ | |
1131 g_snprintf(buf2, sizeof(buf2), "toc_add_permit "); | |
1132 sflap_send(gc, buf2, -1, TYPE_DATA); | |
1133 g_snprintf(buf2, sizeof(buf2), "toc_add_deny "); | |
1134 sflap_send(gc, buf2, -1, TYPE_DATA); | |
1135 break; | |
1136 case 2: | |
1137 /* deny all, permit none. to get here reliably we need to have been in deny | |
1138 * mode, and send an empty toc_add_permit message, which will switch us to permit none */ | |
1139 g_snprintf(buf2, sizeof(buf2), "toc_add_deny "); | |
1140 sflap_send(gc, buf2, -1, TYPE_DATA); | |
1141 g_snprintf(buf2, sizeof(buf2), "toc_add_permit "); | |
1142 sflap_send(gc, buf2, -1, TYPE_DATA); | |
1143 break; | |
1144 case 3: | |
1145 /* permit some. we want to switch to deny mode first, then send the toc_add_permit | |
1146 * message, which will clear and set our permit list. toc sucks. */ | |
1147 g_snprintf(buf2, sizeof(buf2), "toc_add_deny "); | |
1148 sflap_send(gc, buf2, -1, TYPE_DATA); | |
1149 | |
1150 at = g_snprintf(buf2, sizeof(buf2), "toc_add_permit "); | |
1151 list = gc->permit; | |
1152 while (list) { | |
1153 at += g_snprintf(buf2 + at, sizeof(buf2) - at, "%s ", normalize(list->data)); | |
1154 if (at > MSG_LEN + 32) /* from out my ass comes greatness */ { | |
1155 sflap_send(gc, buf2, -1, TYPE_DATA); | |
1156 at = g_snprintf(buf2, sizeof(buf2), "toc_add_permit "); | |
1157 } | |
1158 list = list->next; | |
1159 } | |
1160 sflap_send(gc, buf2, -1, TYPE_DATA); | |
1161 break; | |
1162 case 4: | |
1163 /* deny some. we want to switch to permit mode first, then send the toc_add_deny | |
1164 * message, which will clear and set our deny list. toc sucks. */ | |
1165 g_snprintf(buf2, sizeof(buf2), "toc_add_permit "); | |
1166 sflap_send(gc, buf2, -1, TYPE_DATA); | |
1167 | |
1168 at = g_snprintf(buf2, sizeof(buf2), "toc_add_deny "); | |
1169 list = gc->deny; | |
1170 while (list) { | |
1171 at += g_snprintf(buf2 + at, sizeof(buf2) - at, "%s ", normalize(list->data)); | |
1172 if (at > MSG_LEN + 32) /* from out my ass comes greatness */ { | |
1173 sflap_send(gc, buf2, -1, TYPE_DATA); | |
1174 at = g_snprintf(buf2, sizeof(buf2), "toc_add_deny "); | |
1175 } | |
1176 list = list->next; | |
1177 } | |
1178 sflap_send(gc, buf2, -1, TYPE_DATA); | |
1179 break; | |
1180 default: | |
1181 break; | |
1182 } | |
1183 } | |
1184 | |
1185 static void toc_rem_permit(struct gaim_connection *gc, char *who) { | |
1186 if (gc->permdeny != 3) return; | |
1187 toc_set_permit_deny(gc); | |
1188 } | |
1189 | |
1190 static void toc_rem_deny(struct gaim_connection *gc, char *who) { | |
1191 if (gc->permdeny != 4) return; | |
1192 toc_set_permit_deny(gc); | |
1193 } | |
1194 | |
1108 void toc_init(struct prpl *ret) { | 1195 void toc_init(struct prpl *ret) { |
1109 ret->protocol = PROTO_TOC; | 1196 ret->protocol = PROTO_TOC; |
1110 ret->name = toc_name; | 1197 ret->name = toc_name; |
1111 ret->list_icon = toc_list_icon; | 1198 ret->list_icon = toc_list_icon; |
1112 ret->action_menu = toc_action_menu; | 1199 ret->action_menu = toc_action_menu; |
1124 ret->set_idle = toc_set_idle; | 1211 ret->set_idle = toc_set_idle; |
1125 ret->change_passwd = toc_change_passwd; | 1212 ret->change_passwd = toc_change_passwd; |
1126 ret->add_buddy = toc_add_buddy; | 1213 ret->add_buddy = toc_add_buddy; |
1127 ret->add_buddies = toc_add_buddies; | 1214 ret->add_buddies = toc_add_buddies; |
1128 ret->remove_buddy = toc_remove_buddy; | 1215 ret->remove_buddy = toc_remove_buddy; |
1129 ret->add_permit = NULL; /* FIXME */ | 1216 ret->add_permit = toc_add_permit; |
1130 ret->add_deny = NULL; | 1217 ret->add_deny = toc_add_deny; |
1131 ret->rem_permit = NULL; | 1218 ret->rem_permit = toc_rem_permit; |
1132 ret->rem_deny = NULL; | 1219 ret->rem_deny = toc_add_deny; |
1133 ret->set_permit_deny = NULL; | 1220 ret->set_permit_deny = toc_set_permit_deny; |
1134 ret->warn = toc_warn; | 1221 ret->warn = toc_warn; |
1135 ret->accept_chat = toc_accept_chat; | 1222 ret->accept_chat = toc_accept_chat; |
1136 ret->join_chat = toc_join_chat; | 1223 ret->join_chat = toc_join_chat; |
1137 ret->chat_invite = toc_chat_invite; | 1224 ret->chat_invite = toc_chat_invite; |
1138 ret->chat_leave = toc_chat_leave; | 1225 ret->chat_leave = toc_chat_leave; |