Changeset 3abf28b
- Timestamp:
- Jun 1, 2003, 9:11:25 PM (21 years ago)
- Branches:
- master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 75e3879
- Parents:
- df0d93a
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
aim.c
r0ff8fb57 r3abf28b 411 411 412 412 /*aim_bos_setprofile(sess, fr->conn, profile, awaymsg, AIM_CAPS_BUDDYICON | AIM_CAPS_CHAT | AIM_CAPS_GETFILE | AIM_CAPS_SENDFILE | AIM_CAPS_IMIMAGE | AIM_CAPS_GAMES | AIM_CAPS_SAVESTOCKS | AIM_CAPS_SENDBUDDYLIST | AIM_CAPS_ICQ | AIM_CAPS_ICQUNKNOWN | AIM_CAPS_ICQRTF | AIM_CAPS_ICQSERVERRELAY | AIM_CAPS_TRILLIANCRYPT); */ 413 aim_bos_setprofile(sess, fr->conn, profile, awaymsg, AIM_CAPS_SENDBUDDYLIST | AIM_CAPS_CHAT );413 aim_bos_setprofile(sess, fr->conn, profile, "", AIM_CAPS_SENDBUDDYLIST | AIM_CAPS_CHAT ); 414 414 aim_bos_reqbuddyrights(sess, fr->conn); 415 415 … … 951 951 } else if (strstr(tmpstr, "haveicon") && priv->buddyicon) { 952 952 struct aim_sendimext_args args; 953 static const char iconmsg[] = {"I have an icon"}; 953 /* static const char iconmsg[] = {"I have an icon"}; */ 954 static const char iconmsg[] = {""}; 954 955 955 956 args.destsn = userinfo->sn; … … 961 962 args.iconsum = priv->buddyiconsum; 962 963 963 aim_send_im_ext(sess, &args);964 /* aim_send_im_ext(sess, &args); */ 964 965 965 966 } else if (strstr(tmpstr, "sendbin")) { … … 1170 1171 int clienttype = AIM_CLIENTTYPE_UNKNOWN; 1171 1172 owl_message *m; 1173 char *stripmsg; 1172 1174 char realmsg[8192+1] = {""}; 1173 1175 clienttype = aim_fingerprintclient(args->features, args->featureslen); … … 1244 1246 1245 1247 /* create a message, and put it on the message queue */ 1248 stripmsg=owl_text_htmlstrip(realmsg); 1246 1249 m=owl_malloc(sizeof(owl_message)); 1247 owl_message_create_aim(m, userinfo->sn, owl_global_get_aim_screenname(&g), realmsg); 1248 owl_message_set_direction_in(m); 1250 owl_message_create_incoming_aim(m, userinfo->sn, owl_global_get_aim_screenname(&g), stripmsg); 1249 1251 owl_global_messagequeue_addmsg(&g, m); 1252 owl_free(stripmsg); 1250 1253 1251 1254 /* printf("icbm: message: %s\n", realmsg); */ -
commands.c
r31e48a3 r3abf28b 1567 1567 return NULL; 1568 1568 } 1569 filtname = owl_function_ fastclassinstfilt(argv[1], NULL);1569 filtname = owl_function_classinstfilt(argv[1], NULL); 1570 1570 owl_function_change_view(filtname); 1571 1571 owl_free(filtname); … … 1579 1579 return NULL; 1580 1580 } 1581 filtname = owl_function_fastuserfilt(argv[1]);1581 filtname=owl_function_zuserfilt(argv[1]); 1582 1582 owl_function_change_view(filtname); 1583 1583 owl_free(filtname); -
filter.c
rd09e5a1 r3abf28b 150 150 match=owl_message_get_realm(m); 151 151 } else if (!strcasecmp(field, "type")) { 152 if (owl_message_is_type_zephyr(m)) { 153 match="zephyr"; 154 } else if (owl_message_is_type_aim(m)) { 155 match="aim"; 156 } else if (owl_message_is_type_admin(m)) { 157 match="admin"; 158 } else { 159 match=""; 160 } 152 match=owl_message_type_to_string(m); 161 153 } else if (!strcasecmp(field, "direction")) { 162 154 if (owl_message_is_direction_out(m)) { -
functions.c
rdf0d93a r3abf28b 134 134 /* create the message */ 135 135 m=owl_malloc(sizeof(owl_message)); 136 owl_message_create_aim(m, owl_global_get_aim_screenname(&g), to, body); 137 owl_message_set_direction_out(m); 136 owl_message_create_outgoing_aim(m, owl_global_get_aim_screenname(&g), to, body); 138 137 139 138 /* add it to the global list and current view */ … … 2116 2115 } 2117 2116 2118 char *owl_function_fastclassinstfilt(char *class, char *instance) 2119 { 2120 /* creates a filter for a class, instance if one doesn't exist. 2121 * If instance is null then apply for all messgaes in the class. 2122 * returns the name of the filter, which the caller must free.*/ 2117 /* Create a filter for a class, instance if one doesn't exist. If 2118 * instance is NULL then catch all messgaes in the class. Returns the 2119 * name of the filter, which the caller must free. 2120 */ 2121 char *owl_function_classinstfilt(char *class, char *instance) 2122 { 2123 2123 owl_list *fl; 2124 2124 owl_filter *f; … … 2173 2173 } 2174 2174 2175 char *owl_function_fastuserfilt(char *user) 2175 /* Create a filter for personal zephyrs to or from the specified 2176 * zephyr user. Includes login/logout notifications for the user. 2177 * The name of the filter will be 'user-<user>'. If a filter already 2178 * exists with this name, no new filter will be created. This allows 2179 * the configuration to override this function. Returns the name of 2180 * the filter, which the caller must free. 2181 */ 2182 char *owl_function_zuserfilt(char *user) 2176 2183 { 2177 2184 owl_filter *f; … … 2188 2195 /* if it already exists then go with it. This lets users override */ 2189 2196 if (owl_global_get_filter(&g, filtname)) { 2190 return( filtname);2197 return(owl_strdup(filtname)); 2191 2198 } 2192 2199 … … 2212 2219 } 2213 2220 2214 char *owl_function_fasttypefilt(char *type) 2221 /* Create a filter for AIM IM messages to or from the specified 2222 * screenname. The name of the filter will be 'aimuser-<user>'. If a 2223 * filter already exists with this name, no new filter will be 2224 * created. This allows the configuration to override this function. 2225 * Returns the name of the filter, which the caller must free. 2226 */ 2227 char *owl_function_aimuserfilt(char *user) 2228 { 2229 owl_filter *f; 2230 char *argbuff, *filtname; 2231 2232 /* name for the filter */ 2233 filtname=owl_malloc(strlen(user)+40); 2234 sprintf(filtname, "aimuser-%s", user); 2235 2236 /* if it already exists then go with it. This lets users override */ 2237 if (owl_global_get_filter(&g, filtname)) { 2238 return(owl_strdup(filtname)); 2239 } 2240 2241 /* create the new-internal filter */ 2242 f=owl_malloc(sizeof(owl_filter)); 2243 2244 argbuff=owl_malloc(1000); 2245 sprintf(argbuff, 2246 "( type ^aim$ and ( ( sender ^%s$ and recipient ^%s$ ) or ( sender ^%s$ and recipient ^%s$ ) ) )", 2247 user, owl_global_get_aim_screenname(&g), owl_global_get_aim_screenname(&g), user); 2248 2249 owl_filter_init_fromstring(f, filtname, argbuff); 2250 2251 /* add it to the global list */ 2252 owl_global_add_filter(&g, f); 2253 2254 /* free stuff */ 2255 owl_free(argbuff); 2256 2257 return(filtname); 2258 } 2259 2260 char *owl_function_typefilt(char *type) 2215 2261 { 2216 2262 owl_filter *f; … … 2263 2309 } 2264 2310 2311 /* Create a filter based on the current message. Returns the name of 2312 * a filter or null. The caller must free this name. 2313 * 2314 * if the curmsg is a personal zephyr return a filter name 2315 * to the zephyr converstaion with that user. 2316 * If the curmsg is a zephyr class message, instance foo, recip *, 2317 * return a filter name to the class, inst. 2318 * If the curmsg is a zephyr class message and type==0 then 2319 * return a filter name for just the class. 2320 * If the curmsg is a zephyr class message and type==1 then 2321 * return a filter name for the class and instance. 2322 * If the curmsg is a personal AIM message returna filter 2323 * name to the AIM conversation with that user 2324 */ 2265 2325 char *owl_function_smartfilter(int type) 2266 2326 { 2267 /* Returns the name of a filter, or null. The caller2268 * must free this name. */2269 /* if the curmsg is a personal message return a filter name2270 * to the converstaion with that user.2271 * If the curmsg is a class message, instance foo, recip *2272 * message, return a filter name to the class, inst.2273 * If the curmsg is a class message and type==0 then2274 * return a filter name for just the class.2275 * If the curmsg is a class message and type==1 then2276 * return a filter name for the class and instance.2277 */2278 2327 owl_view *v; 2279 2328 owl_message *m; … … 2290 2339 /* very simple handling of admin messages for now */ 2291 2340 if (owl_message_is_type_admin(m)) { 2292 return(owl_function_fasttypefilt("admin")); 2341 return(owl_function_typefilt("admin")); 2342 } 2343 2344 /* aim messages */ 2345 if (owl_message_is_type_aim(m)) { 2346 if (owl_message_is_direction_in(m)) { 2347 filtname=owl_function_aimuserfilt(owl_message_get_sender(m)); 2348 } else if (owl_message_is_direction_out(m)) { 2349 filtname=owl_function_aimuserfilt(owl_message_get_recipient(m)); 2350 } 2351 return(filtname); 2293 2352 } 2294 2353 … … 2301 2360 zperson=short_zuser(owl_message_get_recipient(m)); 2302 2361 } 2303 filtname=owl_function_ fastuserfilt(zperson);2362 filtname=owl_function_zuserfilt(zperson); 2304 2363 owl_free(zperson); 2305 2364 return(filtname); … … 2309 2368 2310 2369 /* narrow class MESSAGE, instance foo, recip * messages to class, inst */ 2311 if (!strcasecmp(owl_message_get_class(m), "message") && 2312 !owl_message_is_personal(m)) { 2313 filtname=owl_function_fastclassinstfilt(owl_message_get_class(m), owl_message_get_instance(m)); 2370 if (!strcasecmp(owl_message_get_class(m), "message") && !owl_message_is_personal(m)) { 2371 filtname=owl_function_classinstfilt(owl_message_get_class(m), owl_message_get_instance(m)); 2314 2372 return(filtname); 2315 2373 } … … 2317 2375 /* otherwise narrow to the class */ 2318 2376 if (type==0) { 2319 filtname=owl_function_ fastclassinstfilt(owl_message_get_class(m), NULL);2377 filtname=owl_function_classinstfilt(owl_message_get_class(m), NULL); 2320 2378 } else if (type==1) { 2321 filtname=owl_function_ fastclassinstfilt(owl_message_get_class(m), owl_message_get_instance(m));2379 filtname=owl_function_classinstfilt(owl_message_get_class(m), owl_message_get_instance(m)); 2322 2380 } 2323 2381 return(filtname); -
message.c
rdf0d93a r3abf28b 529 529 } 530 530 531 void owl_message_create_ aim(owl_message *m, char *sender, char *recipient, char *text)531 void owl_message_create_incoming_aim(owl_message *m, char *sender, char *recipient, char *text) 532 532 { 533 533 char *indent; … … 538 538 owl_message_set_recipient(m, recipient); 539 539 owl_message_set_type_aim(m); 540 owl_message_set_direction_in(m); 541 542 indent=owl_malloc(strlen(text)+owl_text_num_lines(text)*OWL_MSGTAB+10); 543 owl_text_indent(indent, text, OWL_MSGTAB); 544 owl_fmtext_init_null(&(m->fmtext)); 545 owl_fmtext_append_bold(&(m->fmtext), OWL_TABSTR); 546 owl_fmtext_append_bold(&(m->fmtext), "AIM from "); 547 owl_fmtext_append_bold(&(m->fmtext), sender); 548 owl_fmtext_append_bold(&(m->fmtext), "\n"); 549 owl_fmtext_append_bold(&(m->fmtext), indent); 550 if (text[strlen(text)-1]!='\n') { 551 owl_fmtext_append_bold(&(m->fmtext), "\n"); 552 } 553 554 owl_free(indent); 555 } 556 557 void owl_message_create_outgoing_aim(owl_message *m, char *sender, char *recipient, char *text) 558 { 559 char *indent; 560 561 owl_message_init(m); 562 owl_message_set_body(m, text); 563 owl_message_set_sender(m, sender); 564 owl_message_set_recipient(m, recipient); 565 owl_message_set_type_aim(m); 566 owl_message_set_direction_out(m); 540 567 541 568 indent=owl_malloc(strlen(text)+owl_text_num_lines(text)*OWL_MSGTAB+10); … … 543 570 owl_fmtext_init_null(&(m->fmtext)); 544 571 owl_fmtext_append_normal(&(m->fmtext), OWL_TABSTR); 545 owl_fmtext_append_normal(&(m->fmtext), "AIM: "); 546 owl_fmtext_append_normal(&(m->fmtext), sender); 547 owl_fmtext_append_normal(&(m->fmtext), " -> "); 572 owl_fmtext_append_normal(&(m->fmtext), "AIM sent to "); 548 573 owl_fmtext_append_normal(&(m->fmtext), recipient); 549 574 owl_fmtext_append_normal(&(m->fmtext), "\n"); … … 889 914 owl_fmtext_append_ztext(&(m->fmtext), indent); 890 915 891 /* make p ersonalmessages bold for smaat users */916 /* make private messages bold for smaat users */ 892 917 if (owl_global_is_userclue(&g, OWL_USERCLUE_CLASSES)) { 893 918 if (owl_message_is_personal(m)) { -
owl.c
r31e48a3 r3abf28b 138 138 139 139 /* setup the default filters */ 140 f=malloc(sizeof(owl_filter)); 141 owl_filter_init_fromstring(f, "personal", "class ^message$ and instance ^personal$ and ( recipient ^%me%$ or sender ^%me%$ )"); 140 141 /* the personal filter will need to change again when AIM chat's are 142 * included. Also, there should be an %aimme% */ 143 f=malloc(sizeof(owl_filter)); 144 owl_filter_init_fromstring(f, "personal", "( type ^zephyr$ " 145 "and class ^message$ and instance ^personal$ " 146 "and ( recipient ^%me%$ or sender ^%me%$ ) ) " 147 "or ( type ^aim$ )"); 142 148 owl_list_append_element(owl_global_get_filterlist(&g), f); 143 149 … … 330 336 331 337 /* ring the bell if it's a personal */ 332 if (owl_global_is_personalbell(&g) && owl_message_is_personal(m)) { 338 if (owl_global_is_personalbell(&g) && 339 (owl_message_is_personal(m) || 340 (owl_message_is_type_aim(m) && owl_message_is_to_me(m)))) { 333 341 owl_function_beep(); 334 342 } -
owl_prototypes.h
rdf0d93a r3abf28b 356 356 extern void owl_function_show_filter(char *name); 357 357 extern void owl_function_show_zpunts(); 358 extern char *owl_function_fastclassinstfilt(char *class, char *instance); 359 extern char *owl_function_fastuserfilt(char *user); 360 extern char *owl_function_fasttypefilt(char *type); 358 extern char *owl_function_classinstfilt(char *class, char *instance); 359 extern char *owl_function_zuserfilt(char *user); 360 extern char *owl_function_aimuserfilt(char *user); 361 extern char *owl_function_typefilt(char *type); 361 362 extern void owl_function_delete_curview_msgs(int flag); 362 363 extern char *owl_function_smartfilter(int type); … … 610 611 extern int owl_message_search(owl_message *m, char *string); 611 612 extern void owl_message_create(owl_message *m, char *header, char *text); 612 extern void owl_message_create_aim(owl_message *m, char *sender, char *recipient, char *text); 613 extern void owl_message_create_incoming_aim(owl_message *m, char *sender, char *recipient, char *text); 614 extern void owl_message_create_outgoing_aim(owl_message *m, char *sender, char *recipient, char *text); 613 615 extern void owl_message_create_admin(owl_message *m, char *header, char *text); 614 616 extern void owl_message_create_from_znotice(owl_message *m, ZNotice_t *n); … … 690 692 extern void owl_text_indent(char *out, char *in, int n); 691 693 extern int owl_text_num_lines(char *in); 694 extern char *owl_text_htmlstrip(char *in); 692 695 693 696 /* -------------------------------- util.c -------------------------------- */ -
text.c
r1aee7d9 r3abf28b 127 127 } 128 128 129 130 /* caller must free the return */ 131 char *owl_text_htmlstrip(char *in) { 132 char *ptr1, *end, *ptr2, *ptr3, *out; 133 134 out=owl_malloc(strlen(in)+30); 135 strcpy(out, ""); 136 137 ptr1=in; 138 end=in+strlen(in); 139 140 while(ptr1<end) { 141 /* look for an open bracket */ 142 ptr2=strchr(ptr1, '<'); 143 144 /* if not, copy in from here to end and exit */ 145 if (ptr2==NULL) { 146 strcat(out, ptr1); 147 return(out); 148 } 149 150 /* otherwise copy in everything before the open bracket */ 151 if (ptr2>ptr1) { 152 strncat(out, ptr1, ptr2-ptr1); 153 } 154 155 /* find the close bracket */ 156 ptr3=strchr(ptr2, '>'); 157 158 /* if there is no close, copy as you are and exit */ 159 if (!ptr3) { 160 strcat(out, ptr2); 161 } 162 163 /* look for things we know */ 164 if (!strncasecmp(ptr2, "<BODY ", 6) || 165 !strncasecmp(ptr2, "<FONT ", 6) || 166 !strncasecmp(ptr2, "<HTML", 5) || 167 !strncasecmp(ptr2, "</FONT", 6) || 168 !strncasecmp(ptr2, "</HTML", 6) || 169 !strncasecmp(ptr2, "</BODY", 6)) { 170 171 /* advance to beyond the angle brakcet and go again */ 172 ptr1=ptr3+1; 173 continue; 174 } 175 176 /* if it wasn't something we know, copy to the > and go again */ 177 strncat(out, ptr2, ptr3-ptr2); 178 ptr1=ptr3+1; 179 } 180 return(out); 181 }
Note: See TracChangeset
for help on using the changeset viewer.