Changeset 4fd3c04
- Timestamp:
- Oct 12, 2017, 8:28:02 PM (6 years ago)
- Branches:
- master
- Children:
- a882637
- Parents:
- ee6b30f
- git-author:
- Anders Kaseorg <andersk@mit.edu> (10/06/17 21:27:09)
- git-committer:
- Anders Kaseorg <andersk@mit.edu> (10/12/17 20:28:02)
- Files:
-
- 44 deleted
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile.am
r392b5cf r4fd3c04 43 43 dist_doc_DATA = doc/intro.txt doc/advanced.txt 44 44 45 bin_barnowl_LDADD = compat/libcompat.a libfaim/libfaim.a45 bin_barnowl_LDADD = compat/libcompat.a 46 46 47 47 bin_tester_SOURCES = $(BASE_SRCS) \ … … 50 50 nodist_bin_tester_SOURCES = $(GEN_C) $(GEN_H) 51 51 52 bin_tester_LDADD = compat/libcompat.a libfaim/libfaim.a52 bin_tester_LDADD = compat/libcompat.a 53 53 54 54 TESTS=runtests.sh 55 55 56 56 AM_CPPFLAGS = \ 57 -I$(top_srcdir)/libfaim/ \58 57 -DDATADIR='"$(pkgdatadir)"' \ 59 58 -DBINDIR='"$(bindir)"' … … 65 64 regex.c history.c view.c dict.c variable.c filterelement.c pair.c \ 66 65 keypress.c keymap.c keybinding.c cmd.c context.c \ 67 aim.c buddy.c buddylist.cstyle.c errqueue.c \66 style.c errqueue.c \ 68 67 zbuddylist.c popexec.c select.c wcwidth.c \ 69 68 mainpanel.c msgwin.c sepbar.c editcontext.c signal.c closures.c … … 125 124 cpanfile 126 125 127 SUBDIRS = compat libfaimperl126 SUBDIRS = compat perl -
codelist.pl
r06adc25 r4fd3c04 18 18 && !/^XS/ 19 19 && !/\/\*/ 20 && !/ZWRITEOPTIONS/ 21 && !/owlfaim_priv/) 20 && !/ZWRITEOPTIONS/) 22 21 { 23 22 -
commands.c
r4511ac3 r4fd3c04 122 122 " Send to the specified opcode\n"), 123 123 124 OWLCMD_ARGS("aimwrite", owl_command_aimwrite, OWL_CTX_INTERACTIVE,125 "send an AIM message",126 "aimwrite <user> [-m <message...>]",127 "Send an aim message to a user.\n\n"128 "The following options are available:\n\n"129 "-m Specifies a message to send without prompting.\n"),130 131 124 OWLCMD_ARGS("loopwrite", owl_command_loopwrite, OWL_CTX_INTERACTIVE, 132 125 "send a loopback message", … … 234 227 "Execute the BarnOwl commands in <filename>.\n"), 235 228 236 OWLCMD_ARGS("aim", owl_command_aim, OWL_CTX_INTERACTIVE,237 "AIM specific commands",238 "aim search <email>",239 ""),240 241 229 OWLCMD_ARGS("addbuddy", owl_command_addbuddy, OWL_CTX_INTERACTIVE, 242 230 "add a buddy to a buddylist", 243 231 "addbuddy <protocol> <screenname>", 244 "Add the named buddy to your buddylist. <protocol> can be aim orzephyr\n"),232 "Add the named buddy to your buddylist. <protocol> must be zephyr\n"), 245 233 246 234 OWLCMD_ARGS("delbuddy", owl_command_delbuddy, OWL_CTX_INTERACTIVE, 247 235 "delete a buddy from a buddylist", 248 236 "delbuddy <protocol> <screenname>", 249 "Delete the named buddy from your buddylist. <protocol> can be aim or zephyr\n"), 250 251 OWLCMD_ARGS("join", owl_command_join, OWL_CTX_INTERACTIVE, 252 "join a chat group", 253 "join aim <groupname> [exchange]", 254 "Join the AIM chatroom with 'groupname'.\n"), 237 "Delete the named buddy from your buddylist. <protocol> must be zephyr\n"), 255 238 256 239 OWLCMD_ARGS("smartzpunt", owl_command_smartzpunt, OWL_CTX_INTERACTIVE, … … 308 291 "znol [-f file]", 309 292 "Print a znol-style listing of users logged in"), 310 311 OWLCMD_VOID("alist", owl_command_alist, OWL_CTX_INTERACTIVE,312 "List AIM users logged in",313 "alist",314 "Print a listing of AIM users logged in"),315 293 316 294 OWLCMD_VOID("blist", owl_command_blist, OWL_CTX_INTERACTIVE, … … 470 448 "use the default.\n"), 471 449 472 OWLCMD_ARGS("aaway", owl_command_aaway, OWL_CTX_INTERACTIVE,473 "Set, enable or disable AIM away message",474 "aaway [ on | off | toggle ]\n"475 "aaway <message>",476 "Turn on or off the AIM away message. If 'message' is\n"477 "specified turn on aaway with that message, otherwise\n"478 "use the default.\n"),479 480 450 OWLCMD_ARGS("away", owl_command_away, OWL_CTX_INTERACTIVE, 481 451 "Set, enable or disable all away messages", … … 486 456 "otherwise use the default.\n" 487 457 "\n" 488 "SEE ALSO: aaway,zaway"),458 "SEE ALSO: zaway"), 489 459 490 460 OWLCMD_ARGS("flush-logs", owl_command_flushlogs, OWL_CTX_ANY, … … 548 518 " body - message body\n" 549 519 " hostname - hostname of sending host\n" 550 " type - message type (zephyr, a im, admin)\n"520 " type - message type (zephyr, admin)\n" 551 521 " direction - either 'in' 'out' or 'none'\n" 552 522 " login - either 'login' 'logout' or 'none'\n" … … 772 742 "no argument, it makes search highlighting inactive."), 773 743 774 OWLCMD_ARGS("aimlogin", owl_command_aimlogin, OWL_CTX_ANY,775 "login to an AIM account",776 "aimlogin <screenname> [<password>]\n",777 ""),778 779 OWLCMD_ARGS("aimlogout", owl_command_aimlogout, OWL_CTX_ANY,780 "logout from AIM",781 "aimlogout\n",782 ""),783 784 744 OWLCMD_ARGS("error", owl_command_error, OWL_CTX_ANY, 785 745 "Display an error message", … … 1108 1068 } 1109 1069 } 1110 owl_function_buddylist( 0,1, file);1070 owl_function_buddylist(1, file); 1111 1071 return(NULL); 1112 1072 } 1113 1073 1114 void owl_command_alist(void)1115 {1116 owl_function_buddylist(1, 0, NULL);1117 }1118 1119 1074 void owl_command_blist(void) 1120 1075 { 1121 owl_function_buddylist(1, 1,NULL);1076 owl_function_buddylist(1, NULL); 1122 1077 } 1123 1078 … … 1135 1090 { 1136 1091 owl_function_makemsg("BarnOwl version %s", version); 1137 }1138 1139 char *owl_command_aim(int argc, const char *const *argv, const char *buff)1140 {1141 if (argc<2) {1142 owl_function_makemsg("not enough arguments to aim command");1143 return(NULL);1144 }1145 1146 if (!strcmp(argv[1], "search")) {1147 if (argc!=3) {1148 owl_function_makemsg("not enough arguments to aim search command");1149 return(NULL);1150 }1151 owl_aim_search(argv[2]);1152 } else {1153 owl_function_makemsg("unknown subcommand '%s' for aim command", argv[1]);1154 return(NULL);1155 }1156 return(NULL);1157 1092 } 1158 1093 … … 1164 1099 } 1165 1100 1166 if (!strcasecmp(argv[1], "aim")) { 1167 if (!owl_global_is_aimloggedin(&g)) { 1168 owl_function_makemsg("addbuddy: You must be logged into aim to use this command."); 1169 return(NULL); 1170 } 1171 /* 1172 owl_function_makemsg("This function is not yet operational. Stay tuned."); 1173 return(NULL); 1174 */ 1175 owl_aim_addbuddy(argv[2]); 1176 owl_function_makemsg("%s added as AIM buddy for %s", argv[2], owl_global_get_aim_screenname(&g)); 1177 } else if (!strcasecmp(argv[1], "zephyr")) { 1101 if (!strcasecmp(argv[1], "zephyr")) { 1178 1102 owl_zephyr_addbuddy(argv[2]); 1179 1103 owl_function_makemsg("%s added as zephyr buddy", argv[2]); 1180 1104 } else { 1181 owl_function_makemsg("addbuddy: currently the only supported protocol s are 'zephyr' and 'aim'");1105 owl_function_makemsg("addbuddy: currently the only supported protocol is 'zephyr'"); 1182 1106 } 1183 1107 … … 1192 1116 } 1193 1117 1194 if (!strcasecmp(argv[1], "aim")) { 1195 if (!owl_global_is_aimloggedin(&g)) { 1196 owl_function_makemsg("delbuddy: You must be logged into aim to use this command."); 1197 return(NULL); 1198 } 1199 owl_aim_delbuddy(argv[2]); 1200 owl_function_makemsg("%s deleted as AIM buddy for %s", argv[2], owl_global_get_aim_screenname(&g)); 1201 } else if (!strcasecmp(argv[1], "zephyr")) { 1118 if (!strcasecmp(argv[1], "zephyr")) { 1202 1119 owl_zephyr_delbuddy(argv[2]); 1203 1120 owl_function_makemsg("%s deleted as zephyr buddy", argv[2]); 1204 1121 } else { 1205 owl_function_makemsg("delbuddy: currently the only supported protocols are 'zephyr' and 'aim'"); 1206 } 1207 1208 return(NULL); 1209 } 1210 1211 char *owl_command_join(int argc, const char *const *argv, const char *buff) 1212 { 1213 if (argc!=3 && argc!=4) { 1214 owl_function_makemsg("usage: join <protocol> <buddyname> [exchange]"); 1215 return(NULL); 1216 } 1217 1218 if (!strcasecmp(argv[1], "aim")) { 1219 if (!owl_global_is_aimloggedin(&g)) { 1220 owl_function_makemsg("join aim: You must be logged into aim to use this command."); 1221 return(NULL); 1222 } 1223 if (argc==3) { 1224 owl_aim_chat_join(argv[2], 4); 1225 } else { 1226 owl_aim_chat_join(argv[2], atoi(argv[3])); 1227 } 1228 /* owl_function_makemsg("%s deleted as AIM buddy for %s", argv[2], owl_global_get_aim_screenname(&g)); */ 1229 } else { 1230 owl_function_makemsg("join: currently the only supported protocol is 'aim'"); 1231 } 1122 owl_function_makemsg("delbuddy: currently the only supported protocol is 'zephyr'"); 1123 } 1124 1232 1125 return(NULL); 1233 1126 } … … 1539 1432 1540 1433 1541 char *owl_command_aaway(int argc, const char *const *argv, const char *buff)1542 {1543 if ((argc==1) ||1544 ((argc==2) && !strcmp(argv[1], "on"))) {1545 owl_global_set_aaway_msg(&g, owl_global_get_aaway_msg_default(&g));1546 owl_function_aaway_on();1547 return NULL;1548 }1549 1550 if (argc==2 && !strcmp(argv[1], "off")) {1551 owl_function_aaway_off();1552 return NULL;1553 }1554 1555 if (argc==2 && !strcmp(argv[1], "toggle")) {1556 owl_function_aaway_toggle();1557 return NULL;1558 }1559 1560 buff = skiptokens(buff, 1);1561 owl_global_set_aaway_msg(&g, buff);1562 owl_function_aaway_on();1563 return NULL;1564 }1565 1566 1567 1434 char *owl_command_away(int argc, const char *const *argv, const char *buff) 1568 1435 { … … 1573 1440 (argc == 2 && !strcmp(argv[1], "on"))) { 1574 1441 away_off = false; 1575 owl_global_set_aaway_msg(&g, owl_global_get_aaway_msg_default(&g));1576 1442 owl_global_set_zaway_msg(&g, owl_global_get_zaway_msg_default(&g)); 1577 1443 } else if (argc == 2 && !strcmp(argv[1], "off")) { … … 1585 1451 1586 1452 if (away_off) { 1587 owl_function_aaway_off();1588 1453 owl_function_zaway_off(); 1589 1454 owl_perlconfig_perl_call_norv("BarnOwl::Hooks::_away_off", 0, NULL); 1590 1455 owl_function_makemsg("Away messages off."); 1591 1456 } else if (message != NULL) { 1592 owl_global_set_aaway_msg(&g, message);1593 1457 owl_global_set_zaway_msg(&g, message); 1594 owl_function_aaway_on();1595 1458 owl_function_zaway_on(); 1596 1459 owl_perlconfig_perl_call_norv("BarnOwl::Hooks::_away_on", 1, &message); 1597 1460 owl_function_makemsg("Away messages set (%s).", message); 1598 1461 } else { 1599 owl_function_aaway_on();1600 1462 owl_function_zaway_on(); 1601 1463 owl_perlconfig_perl_call_norv("BarnOwl::Hooks::_away_on", 0, NULL); … … 2038 1900 } 2039 1901 return(NULL); 2040 }2041 2042 char *owl_command_aimwrite(int argc, const char *const *argv, const char *buff)2043 {2044 char *message = NULL;2045 GString *recip = g_string_new("");2046 const char *const *myargv;2047 int myargc;2048 2049 if (!owl_global_is_aimloggedin(&g)) {2050 owl_function_error("You are not logged in to AIM.");2051 goto err;2052 }2053 2054 /* Skip argv[0]. */2055 myargv = argv+1;2056 myargc = argc-1;2057 while (myargc) {2058 if (!strcmp(myargv[0], "-m")) {2059 if (myargc <= 1) {2060 owl_function_error("No message specified.");2061 goto err;2062 }2063 /* Once we have -m, gobble up everything else on the line */2064 myargv++;2065 myargc--;2066 message = g_strjoinv(" ", (char**)myargv);2067 break;2068 } else {2069 /* squish arguments together to make one screenname w/o spaces for now */2070 g_string_append(recip, myargv[0]);2071 myargv++;2072 myargc--;2073 }2074 }2075 2076 if (recip->str[0] == '\0') {2077 owl_function_error("No recipient specified");2078 goto err;2079 }2080 2081 if (message != NULL)2082 owl_function_aimwrite(recip->str, message, false);2083 else2084 owl_function_aimwrite_setup(recip->str);2085 err:2086 g_string_free(recip, true);2087 g_free(message);2088 return NULL;2089 1902 } 2090 1903 … … 2654 2467 } 2655 2468 2656 char *owl_command_aimlogin(int argc, const char *const *argv, const char *buff)2657 {2658 if ((argc<2) || (argc>3)) {2659 owl_function_makemsg("Wrong number of arguments to aimlogin command");2660 return(NULL);2661 }2662 2663 /* if we get two arguments, ask for the password */2664 if (argc==2) {2665 owl_editwin *e = owl_function_start_password("AIM Password: ");2666 owl_editwin_set_cbdata(e, g_strdup(argv[1]), g_free);2667 owl_editwin_set_callback(e, owl_callback_aimlogin);2668 return(NULL);2669 } else {2670 owl_function_aimlogin(argv[1], argv[2]);2671 }2672 2673 /* this is a test */2674 return(NULL);2675 }2676 2677 char *owl_command_aimlogout(int argc, const char *const *argv, const char *buff)2678 {2679 /* clear the buddylist */2680 owl_buddylist_clear(owl_global_get_buddylist(&g));2681 2682 owl_aim_logout();2683 return(NULL);2684 }2685 2686 2469 CALLER_OWN char *owl_command_getstyle(int argc, const char *const *argv, const char *buff) 2687 2470 { -
configure.ac
r370d94d r4fd3c04 176 176 AX_APPEND_COMPILE_FLAGS([-Wno-format-zero-length],[AM_CFLAGS]) 177 177 178 AX_APPEND_COMPILE_FLAGS([-Wno-pointer-sign -Wno-empty-body -Wno-unused-value],[LIBFAIM_CFLAGS])179 180 178 AM_CONDITIONAL([ENABLE_ZCRYPT], [test "$HAVE_DES_STRING_TO_KEY" && dnl 181 179 test "$HAVE_DES_KEY_SCHED" && dnl … … 194 192 195 193 AC_SUBST([AM_CFLAGS]) 196 AC_SUBST([LIBFAIM_CFLAGS])197 194 198 195 AC_SUBST(XSUBPPDIR) … … 213 210 AC_SUBST([abs_srcdir]) 214 211 215 AC_CONFIG_FILES([Makefile compat/Makefile libfaim/Makefileperl/Makefile perl/modules/Makefile])212 AC_CONFIG_FILES([Makefile compat/Makefile perl/Makefile perl/modules/Makefile]) 216 213 AC_OUTPUT -
doc/advanced.txt
rc82b055 r4fd3c04 42 42 realm zephyr realm 43 43 body message body 44 type message type ('zephyr', 'a im', 'admin')44 type message type ('zephyr', 'admin') 45 45 direction either 'in' 'out' or 'none'\n" 46 46 login either 'login' 'logout' or 'none'\n" … … 103 103 All owl::Message objects contain the following methods: 104 104 105 type - returns the type of the message ("zephyr", "a im", "admin")105 type - returns the type of the message ("zephyr", "admin") 106 106 direction - returns "in" or "out" for incoming or outgoing messages 107 107 time - returns a string of the time when the message showed up … … 126 126 127 127 header - returns the admin message header line (admin) 128 is_personal - returns true if this is a personal message ( aim,zephyr)128 is_personal - returns true if this is a personal message (zephyr) 129 129 is_private - returns true if this was a private message (zephyr) 130 130 login_tty - returns the login tty for login messages (zephyr) -
doc/intro.txt
rd7cc50b r4fd3c04 8 8 9 9 Owl is a tty, curses-based instant messaging client. This is a quick 10 guide to learning how to use it. Currently Owl supports AIM &zephyr,10 guide to learning how to use it. Currently Owl supports zephyr, 11 11 but other messaging protocols, including Jabber, are on the way. Some 12 12 major features of owl include: … … 73 73 If you wish to send to a class/instance pair simply supply -c and -i 74 74 arguments to the zwrite command as you normally would. 75 76 Sending an AIM message77 ----------------------78 79 Before sending an AIM message you must login to AOL Instant Messenger.80 Use the 'aimlogin' command, with your screenname as an argument:81 82 aimlogin <screenname>83 84 You will be prompted for your password, which you must enter. Once85 you are successfully logged in you can send an AIM message by pressing86 the 'a' key, which will bring up an 'aimwrite' command:87 88 aimwrite <screenname>89 90 Supply the screen name you wish to write to as an argument and then91 send the message just as you would send a zephyr, as described above.92 75 93 76 Manipulating Messages … … 256 239 auto Messages generated by automated programs 257 240 out Messages sent from you to another user 258 aim AIM messages259 241 zephyr Zephyr messages 260 242 trash "Trash" messages -
functions.c
ree6b30f r4fd3c04 170 170 "':sub @b(class)', and then type ':zwrite -c @b(class)' to send.\n\n" 171 171 #endif 172 "@b(AIM:)\n"173 "Log in to AIM with ':aimlogin @b(screenname)'. Use ':aimwrite @b(screenname)',\n"174 "or 'a' and then the screen name, to send someone a message.\n\n"175 172 ; 176 173 … … 239 236 } 240 237 241 /* Create an outgoing AIM message, returns a pointer to the created242 * message or NULL if we're not logged into AIM (and thus unable to243 * create the message). Does not put it on the global queue. Use244 * owl_global_messagequeue_addmsg() for that.245 */246 CALLER_OWN owl_message *owl_function_make_outgoing_aim(const char *body, const char *to)247 {248 owl_message *m;249 250 /* error if we're not logged into aim */251 if (!owl_global_is_aimloggedin(&g)) return(NULL);252 253 m=g_slice_new(owl_message);254 owl_message_create_aim(m,255 owl_global_get_aim_screenname(&g),256 to,257 body,258 OWL_MESSAGE_DIRECTION_OUT,259 0);260 return(m);261 }262 263 238 /* Create an outgoing loopback message and return a pointer to it. 264 239 * Does not append it to the global queue, use … … 325 300 } 326 301 327 void owl_function_aimwrite_setup(const char *to)328 {329 owl_editwin *e;330 /* TODO: We probably actually want an owl_aimwrite object like331 * owl_zwrite. */332 char *line = g_strdup_printf("aimwrite %s", to);333 owl_function_write_setup("message");334 e = owl_function_start_edit_win(line);335 owl_editwin_set_cbdata(e, g_strdup(to), g_free);336 owl_editwin_set_callback(e, &owl_callback_aimwrite);337 g_free(line);338 }339 340 302 void owl_function_loopwrite_setup(void) 341 303 { … … 436 398 g_free(cryptmsg); 437 399 g_free(old_msg); 438 }439 440 void owl_callback_aimwrite(owl_editwin *e, bool success)441 {442 if (!success) return;443 char *to = owl_editwin_get_cbdata(e);444 owl_function_aimwrite(to, owl_editwin_get_text(e), true);445 }446 447 void owl_function_aimwrite(const char *to, const char *msg, bool unwrap)448 {449 int ret;450 char *format_msg;451 owl_message *m;452 453 /* make a formatted copy of the message */454 format_msg = g_strdup(msg);455 if (unwrap)456 owl_text_wordunwrap(format_msg);457 458 /* send the message */459 ret=owl_aim_send_im(to, format_msg);460 if (!ret) {461 owl_function_makemsg("AIM message sent.");462 } else {463 owl_function_error("Could not send AIM message.");464 }465 466 /* create the outgoing message */467 m=owl_function_make_outgoing_aim(msg, to);468 469 if (m) {470 owl_global_messagequeue_addmsg(&g, m);471 } else {472 owl_function_error("Could not create outgoing AIM message");473 }474 475 g_free(format_msg);476 }477 478 void owl_function_send_aimawymsg(const char *to, const char *msg)479 {480 int ret;481 char *format_msg;482 owl_message *m;483 484 /* make a formatted copy of the message */485 format_msg=g_strdup(msg);486 owl_text_wordunwrap(format_msg);487 488 /* send the message */489 ret=owl_aim_send_awaymsg(to, format_msg);490 if (!ret) {491 /* owl_function_makemsg("AIM message sent."); */492 } else {493 owl_function_error("Could not send AIM message.");494 }495 496 /* create the message */497 m=owl_function_make_outgoing_aim(msg, to);498 if (m) {499 owl_global_messagequeue_addmsg(&g, m);500 } else {501 owl_function_error("Could not create AIM message");502 }503 g_free(format_msg);504 400 } 505 401 … … 918 814 } 919 815 920 void owl_callback_aimlogin(owl_editwin *e, bool success)921 {922 if (!success) return;923 char *user = owl_editwin_get_cbdata(e);924 owl_function_aimlogin(user,925 owl_editwin_get_text(e));926 }927 928 void owl_function_aimlogin(const char *user, const char *passwd) {929 int ret;930 931 /* clear the buddylist */932 owl_buddylist_clear(owl_global_get_buddylist(&g));933 934 /* try to login */935 ret=owl_aim_login(user, passwd);936 if (ret) owl_function_makemsg("Warning: login for %s failed.\n", user);937 }938 939 816 void owl_function_suspend(void) 940 817 { … … 969 846 } 970 847 971 void owl_function_aaway_toggle(void)972 {973 if (!owl_global_is_aaway(&g)) {974 owl_global_set_aaway_msg(&g, owl_global_get_aaway_msg_default(&g));975 owl_function_aaway_on();976 } else {977 owl_function_aaway_off();978 }979 }980 981 void owl_function_aaway_on(void)982 {983 owl_global_set_aaway_on(&g);984 /* owl_aim_set_awaymsg(owl_global_get_zaway_msg(&g)); */985 owl_function_makemsg("AIM away set (%s)", owl_global_get_aaway_msg(&g));986 }987 988 void owl_function_aaway_off(void)989 {990 owl_global_set_aaway_off(&g);991 /* owl_aim_set_awaymsg(""); */992 owl_function_makemsg("AIM away off");993 }994 995 848 bool owl_function_is_away(void) 996 849 { 997 850 return owl_global_is_zaway(&g) || 998 owl_global_is_aaway(&g) ||999 851 owl_perlconfig_perl_call_bool("BarnOwl::Hooks::_get_is_away", 0, NULL); 1000 852 } … … 1017 869 if (owl_global_get_newmsgproc_pid(&g)) { 1018 870 kill(owl_global_get_newmsgproc_pid(&g), SIGHUP); 1019 }1020 1021 /* Quit AIM */1022 if (owl_global_is_aimloggedin(&g)) {1023 owl_aim_logout();1024 871 } 1025 872 … … 1822 1669 owl_fmtext_append_normal(&fm, "no\n"); 1823 1670 } 1824 owl_fmtext_append_normal(&fm, " AIM included : yes\n");1825 1671 owl_fmtext_append_normal(&fm, " Loopback included : yes\n"); 1826 1672 … … 1833 1679 owl_fmtext_append_normal(&fm, "no\n"); 1834 1680 #endif 1835 1836 1837 owl_fmtext_append_normal(&fm, "\nAIM Status:\n");1838 owl_fmtext_append_normal(&fm, " Logged in: ");1839 if (owl_global_is_aimloggedin(&g)) {1840 owl_fmtext_append_normal(&fm, owl_global_get_aim_screenname(&g));1841 owl_fmtext_append_normal(&fm, "\n");1842 } else {1843 owl_fmtext_append_normal(&fm, "(not logged in)\n");1844 }1845 1846 owl_fmtext_append_normal(&fm, " Processing events: ");1847 if (owl_global_is_doaimevents(&g)) {1848 owl_fmtext_append_normal(&fm, "yes\n");1849 } else {1850 owl_fmtext_append_normal(&fm, "no\n");1851 }1852 1681 1853 1682 owl_function_popless_fmtext(&fm); … … 2446 2275 if (f == NULL) { 2447 2276 /* Couldn't make a filter for some reason. Return NULL. */ 2448 owl_function_error("Error creating filter '%s'", filtname);2449 g_free(filtname);2450 return NULL;2451 }2452 2453 /* add it to the global list */2454 owl_global_add_filter(&g, f);2455 2456 return(filtname);2457 }2458 2459 /* Create a filter for AIM IM messages to or from the specified2460 * screenname. The name of the filter will be 'aimuser-<user>'. If a2461 * filter already exists with this name, no new filter will be2462 * created. This allows the configuration to override this function.2463 * Returns the name of the filter, which the caller must free.2464 */2465 CALLER_OWN char *owl_function_aimuserfilt(const char *user)2466 {2467 owl_filter *f;2468 char *argbuff, *filtname;2469 char *escuser;2470 2471 /* name for the filter */2472 filtname=g_strdup_printf("aimuser-%s", user);2473 2474 /* if it already exists then go with it. This lets users override */2475 if (owl_global_get_filter(&g, filtname)) {2476 return filtname;2477 }2478 2479 /* create the new-internal filter */2480 escuser = owl_text_quote(user, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);2481 2482 argbuff = g_strdup_printf(2483 "( type ^aim$ and ( ( sender ^%1$s$ and recipient ^%2$s$ ) or "2484 "( sender ^%2$s$ and recipient ^%1$s$ ) ) )",2485 escuser, owl_global_get_aim_screenname_for_filters(&g));2486 g_free(escuser);2487 2488 f = owl_filter_new_fromstring(filtname, argbuff);2489 g_free(argbuff);2490 2491 if (f == NULL) {2492 2277 owl_function_error("Error creating filter '%s'", filtname); 2493 2278 g_free(filtname); … … 2606 2391 * If the curmsg is a zephyr class message and type==1 then 2607 2392 * return a filter name for the class and instance. 2608 * If the curmsg is a personal AIM message returna filter2609 * name to the AIM conversation with that user2610 2393 */ 2611 2394 CALLER_OWN char *owl_function_smartfilter(int type, int invert_related) … … 2633 2416 if (owl_message_is_type_loopback(m)) { 2634 2417 return(owl_function_typefilt("loopback")); 2635 }2636 2637 /* aim messages */2638 if (owl_message_is_type_aim(m)) {2639 if (owl_message_is_direction_in(m)) {2640 filtname=owl_function_aimuserfilt(owl_message_get_sender(m));2641 } else if (owl_message_is_direction_out(m)) {2642 filtname=owl_function_aimuserfilt(owl_message_get_recipient(m));2643 }2644 return(filtname);2645 2418 } 2646 2419 … … 3070 2843 3071 2844 /* Popup a buddylisting. If filename is NULL use the default .anyone */ 3072 void owl_function_buddylist(int aim, intzephyr, const char *filename)3073 { 3074 int i , j, idle;2845 void owl_function_buddylist(int zephyr, const char *filename) 2846 { 2847 int i; 3075 2848 int interrupted = 0; 3076 2849 owl_fmtext fm; 3077 const owl_buddylist *bl;3078 const owl_buddy *b;3079 char *timestr;3080 2850 #ifdef HAVE_LIBZEPHYR 3081 2851 int x; … … 3088 2858 3089 2859 owl_fmtext_init_null(&fm); 3090 3091 /* AIM first */3092 if (aim && owl_global_is_aimloggedin(&g)) {3093 bl=owl_global_get_buddylist(&g);3094 3095 owl_fmtext_append_bold(&fm, "AIM users logged in:\n");3096 /* we're assuming AIM for now */3097 j=owl_buddylist_get_size(bl);3098 for (i=0; i<j; i++) {3099 b=owl_buddylist_get_buddy_n(bl, i);3100 idle=owl_buddy_get_idle_time(b);3101 if (idle!=0) {3102 timestr=owl_util_format_minutes(idle);3103 } else {3104 timestr=g_strdup("");3105 }3106 owl_fmtext_appendf_normal(&fm, " %-20.20s %-12.12s\n", owl_buddy_get_name(b), timestr);3107 g_free(timestr);3108 }3109 }3110 2860 3111 2861 #ifdef HAVE_LIBZEPHYR … … 3164 2914 #endif 3165 2915 3166 if ( aim &&zephyr) {2916 if (zephyr) { 3167 2917 if (owl_perlconfig_is_function("BarnOwl::Hooks::_get_blist")) { 3168 2918 char * perlblist = owl_perlconfig_execute("BarnOwl::Hooks::_get_blist()"); … … 3508 3258 } 3509 3259 3510 void owl_function_aimsearch_results(const char *email, GPtrArray *namelist)3511 {3512 owl_fmtext fm;3513 int i;3514 3515 owl_fmtext_init_null(&fm);3516 owl_fmtext_append_normal(&fm, "AIM screennames associated with ");3517 owl_fmtext_append_normal(&fm, email);3518 owl_fmtext_append_normal(&fm, ":\n");3519 3520 for (i = 0; i < namelist->len; i++) {3521 owl_fmtext_append_normal(&fm, " ");3522 owl_fmtext_append_normal(&fm, namelist->pdata[i]);3523 owl_fmtext_append_normal(&fm, "\n");3524 }3525 3526 owl_function_popless_fmtext(&fm);3527 owl_fmtext_cleanup(&fm);3528 }3529 3530 3260 int owl_function_get_color_count(void) 3531 3261 { -
global.c
r7dcef03 r4fd3c04 84 84 _owl_global_init_windows(g); 85 85 86 g->aim_screenname=NULL;87 g->aim_screenname_for_filters=NULL;88 g->aim_loggedin=0;89 owl_buddylist_init(&(g->buddylist));90 91 86 g->havezephyr=0; 92 g->haveaim=0;93 g->ignoreaimlogin=0;94 owl_global_set_no_doaimevents(g);95 87 96 88 owl_errqueue_init(&(g->errqueue)); … … 646 638 } 647 639 648 /* AIM stuff */649 650 int owl_global_is_aimloggedin(const owl_global *g)651 {652 if (g->aim_loggedin) return(1);653 return(0);654 }655 656 const char *owl_global_get_aim_screenname(const owl_global *g)657 {658 if (owl_global_is_aimloggedin(g)) {659 return (g->aim_screenname);660 }661 return("");662 }663 664 const char *owl_global_get_aim_screenname_for_filters(const owl_global *g)665 {666 if (owl_global_is_aimloggedin(g)) {667 return (g->aim_screenname_for_filters);668 }669 return("");670 }671 672 void owl_global_set_aimloggedin(owl_global *g, const char *screenname)673 {674 char *sn_escaped;675 g->aim_loggedin=1;676 if (g->aim_screenname) g_free(g->aim_screenname);677 if (g->aim_screenname_for_filters) g_free(g->aim_screenname_for_filters);678 g->aim_screenname=g_strdup(screenname);679 sn_escaped = owl_text_quote(screenname, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);680 g->aim_screenname_for_filters = owl_arg_quote(sn_escaped);681 g_free(sn_escaped);682 }683 684 void owl_global_set_aimnologgedin(owl_global *g)685 {686 g->aim_loggedin=0;687 }688 689 bool owl_global_is_doaimevents(const owl_global *g)690 {691 return g->aim_event_source != NULL;692 }693 694 void owl_global_set_doaimevents(owl_global *g)695 {696 if (g->aim_event_source)697 return;698 g->aim_event_source = owl_aim_event_source_new(owl_global_get_aimsess(g));699 g_source_attach(g->aim_event_source, NULL);700 }701 702 void owl_global_set_no_doaimevents(owl_global *g)703 {704 if (!g->aim_event_source)705 return;706 g_source_destroy(g->aim_event_source);707 g_source_unref(g->aim_event_source);708 g->aim_event_source = NULL;709 }710 711 aim_session_t *owl_global_get_aimsess(owl_global *g)712 {713 return(&(g->aimsess));714 }715 716 aim_conn_t *owl_global_get_bosconn(owl_global *g)717 {718 return(&(g->bosconn));719 }720 721 void owl_global_set_bossconn(owl_global *g, aim_conn_t *conn)722 {723 g->bosconn=*conn;724 }725 726 640 /* message queue */ 727 641 … … 750 664 } 751 665 752 owl_buddylist *owl_global_get_buddylist(owl_global *g)753 {754 return(&(g->buddylist));755 }756 757 666 /* style */ 758 667 … … 781 690 owl_dict_insert_element(&(g->styledict), owl_style_get_name(s), 782 691 s, (void (*)(void *))owl_style_delete); 783 }784 785 void owl_global_set_haveaim(owl_global *g)786 {787 g->haveaim=1;788 }789 790 int owl_global_is_haveaim(const owl_global *g)791 {792 if (g->haveaim) return(1);793 return(0);794 }795 796 void owl_global_set_ignore_aimlogin(owl_global *g)797 {798 g->ignoreaimlogin = 1;799 }800 801 void owl_global_unset_ignore_aimlogin(owl_global *g)802 {803 g->ignoreaimlogin = 0;804 }805 806 int owl_global_is_ignore_aimlogin(const owl_global *g)807 {808 return g->ignoreaimlogin;809 692 } 810 693 … … 867 750 { "reply-lockout", "class ^mail$ or class ^filsrv$" }, 868 751 { "out", "direction ^out$" }, 869 { "aim", "type ^aim$" },870 752 { "zephyr", "type ^zephyr$" }, 871 753 { "none", "false" }, -
help.c
r8258ea5 r4fd3c04 52 52 "\n" 53 53 " z Start a zwrite command\n" 54 " a Start an aimwrite command\n"55 54 " r Reply to the current message\n" 56 55 " R Reply to sender\n" … … 64 63 " ! Invert the current view\n" 65 64 "\n" 66 " l Print a zephyr /AIMbuddy listing\n"65 " l Print a zephyr buddy listing\n" 67 66 " A Toggle away\n" 68 67 " o Toggle one-line display mode\n" … … 88 87 "\n" 89 88 " zwrite Send a zephyr\n" 90 " aimlogin Login to AIM\n"91 " aimwrite Send an AIM message\n"92 89 "\n" 93 " addbuddy Add a zephyr or AIMbuddy\n"90 " addbuddy Add a zephyr buddy\n" 94 91 " zaway Turn zaway on or off, or set the message\n" 95 92 " zlocate Locate a user\n" 96 93 " subscribe Subscribe to a zephyr class or instance\n" 97 94 " unsubscribe Unsubscribe to a zephyr class or instance\n" 98 " blist Print a list of zephyr and AIMbuddies logged in\n"95 " blist Print a list of zephyr buddies logged in\n" 99 96 " search Search for a text string\n" 100 97 "\n" … … 110 107 " zlog Send a login or logout notification\n" 111 108 " zlist Print a list of zephyr buddies logged in\n" 112 " alist Print a list of AIM buddies logged in\n"113 109 " info Print detailed information about the current message\n" 114 110 " filter Create a message filter\n" -
keys.c
rd400776 r4fd3c04 317 317 318 318 BIND_CMD("z", "start-command zwrite ", "start a zwrite command"); 319 BIND_CMD("a", "start-command aimwrite ", "start an aimwrite command");320 319 BIND_CMD("r", "reply", "reply to the current message"); 321 320 BIND_CMD("R", "reply sender", "reply to sender of the current message"); -
message.c
ree6b30f r4fd3c04 371 371 } 372 372 373 void owl_message_set_type_aim(owl_message *m)374 {375 owl_message_set_attribute(m, "type", "AIM");376 }377 378 373 void owl_message_set_type(owl_message *m, const char* type) 379 374 { … … 395 390 { 396 391 return owl_message_is_type(m, "zephyr"); 397 }398 399 int owl_message_is_type_aim(const owl_message *m)400 {401 return owl_message_is_type(m, "aim");402 392 } 403 393 … … 686 676 } 687 677 688 689 /* if loginout == -1 it's a logout message690 * 0 it's not a login/logout message691 * 1 it's a login message692 */693 void owl_message_create_aim(owl_message *m, const char *sender, const char *recipient, const char *text, int direction, int loginout)694 {695 owl_message_init(m);696 owl_message_set_body(m, text);697 owl_message_set_sender(m, sender);698 owl_message_set_recipient(m, recipient);699 owl_message_set_type_aim(m);700 701 if (direction==OWL_MESSAGE_DIRECTION_IN) {702 owl_message_set_direction_in(m);703 } else if (direction==OWL_MESSAGE_DIRECTION_OUT) {704 owl_message_set_direction_out(m);705 }706 707 /* for now all messages that aren't loginout are private */708 if (!loginout) {709 owl_message_set_isprivate(m);710 }711 712 if (loginout==-1) {713 owl_message_set_islogout(m);714 } else if (loginout==1) {715 owl_message_set_islogin(m);716 }717 }718 678 719 679 void owl_message_create_admin(owl_message *m, const char *header, const char *text) -
owl.c
r4ead7b3 r4fd3c04 187 187 if (owl_message_is_type_zephyr(m)) { 188 188 owl_zephyr_zaway(m); 189 } else if (owl_message_is_type_aim(m)) {190 if (owl_message_is_private(m)) {191 owl_function_send_aimawymsg(owl_message_get_sender(m), owl_global_get_zaway_msg(&g));192 }193 189 } 194 190 } … … 504 500 owl_global_set_startupargs(&g, argc_copy, argv_copy); 505 501 g_strfreev(argv_copy); 506 owl_global_set_haveaim(&g);507 502 508 503 owl_register_signal_handlers(); … … 564 559 owl_global_get_filter(&g, "all"), 565 560 owl_global_get_style_by_name(&g, "default")); 566 567 /* AIM init */568 owl_function_debugmsg("startup: doing AIM initialization");569 owl_aim_init();570 561 571 562 /* execute the startup function in the configfile */ -
owl.h
rca1fb26a r4fd3c04 35 35 #include <termios.h> 36 36 #include <unistd.h> 37 #include "libfaim/aim.h"38 37 #include <wchar.h> 39 38 #include <glib.h> … … 108 107 #define OWL_EDITWIN_STYLE_MULTILINE 0 109 108 #define OWL_EDITWIN_STYLE_ONELINE 1 110 111 #define OWL_PROTOCOL_ZEPHYR 0112 #define OWL_PROTOCOL_AIM 1113 #define OWL_PROTOCOL_JABBER 2114 #define OWL_PROTOCOL_ICQ 3115 #define OWL_PROTOCOL_YAHOO 4116 #define OWL_PROTOCOL_MSN 5117 109 118 110 #define OWL_MESSAGE_DIRECTION_NONE 0 … … 178 170 179 171 #define OWL_DEFAULT_ZAWAYMSG "I'm sorry, but I am currently away from the terminal and am\nnot able to receive your message.\n" 180 #define OWL_DEFAULT_AAWAYMSG "I'm sorry, but I am currently away from the terminal and am\nnot able to receive your message.\n"181 172 182 173 #define OWL_CMD_ALIAS_SUMMARY_PREFIX "command alias to: " … … 492 483 int kpstackpos; /* location in stack (-1 = none) */ 493 484 } owl_keyhandler; 494 495 typedef struct _owl_buddy {496 int proto;497 char *name;498 int isidle;499 int idlesince;500 } owl_buddy;501 502 typedef struct _owl_buddylist {503 GPtrArray *buddies;504 } owl_buddylist;505 485 506 486 typedef struct _owl_zbuddylist { … … 569 549 pid_t newmsgproc_pid; 570 550 owl_regex search_re; 571 aim_session_t aimsess; 572 aim_conn_t bosconn; 573 int aim_loggedin; /* true if currently logged into AIM */ 574 GSource *aim_event_source; /* where we get our AIM events from */ 575 char *aim_screenname; /* currently logged in AIM screen name */ 576 char *aim_screenname_for_filters; /* currently logged in AIM screen name */ 577 owl_buddylist buddylist; /* list of logged in AIM buddies */ 578 GQueue *messagequeue; /* for queueing up aim and other messages */ 551 GQueue *messagequeue; /* for queueing up messages */ 579 552 owl_dict styledict; /* global dictionary of available styles */ 580 553 char *response; /* response to the last question asked */ 581 554 int havezephyr; 582 int haveaim;583 int ignoreaimlogin;584 555 owl_zbuddylist zbuddies; 585 556 GList *zaldlist; 586 557 int pseudologin_notify; 587 558 struct termios startup_tio; 588 guint aim_nop_timer;589 559 int load_initial_subs; 590 560 FILE *debug_file; -
perl/Makefile.am
reea7bed4 r4fd3c04 2 2 nobase_dist_pkgdata_DATA = \ 3 3 lib/BarnOwl.pm \ 4 lib/BarnOwl/Complete/AIM.pm \5 4 lib/BarnOwl/Complete/Client.pm \ 6 5 lib/BarnOwl/Complete/Filter.pm \ … … 17 16 lib/BarnOwl/MainLoopCompatHook.pm \ 18 17 lib/BarnOwl/Message.pm \ 19 lib/BarnOwl/Message/AIM.pm \20 18 lib/BarnOwl/Message/Admin.pm \ 21 19 lib/BarnOwl/Message/Generic.pm \ -
perl/lib/BarnOwl/Complete/Filter.pm
r6dba228 r4fd3c04 36 36 body => undef, 37 37 hostname => undef, 38 type => sub { qw(zephyr a im admin); },38 type => sub { qw(zephyr admin); }, 39 39 direction => sub { qw(in out none); }, 40 40 login => sub { qw(login logout none); }, -
perl/lib/BarnOwl/Logging.pm
rb807d8f r4fd3c04 75 75 summary => 'enable logging of login notifications', 76 76 description => "When this is enabled, BarnOwl will log login and logout notifications\n" 77 . "for AIM, zephyr,or other protocols. If disabled BarnOwl will not log\n"77 . "for zephyr or other protocols. If disabled BarnOwl will not log\n" 78 78 . "login or logout notifications." 79 79 }); -
perl/lib/BarnOwl/Message.pm
r5dee79a r4fd3c04 7 7 8 8 use BarnOwl::Message::Admin; 9 use BarnOwl::Message::AIM;10 9 use BarnOwl::Message::Generic; 11 10 use BarnOwl::Message::Loopback; … … 43 42 sub is_generic { return (shift->{"type"} eq "generic"); } 44 43 sub is_zephyr { return (shift->{"type"} eq "zephyr"); } 45 sub is_aim { return (shift->{"type"} eq "AIM"); }44 sub is_aim { return ''; } 46 45 sub is_jabber { return (shift->{"type"} eq "jabber"); } 47 46 sub is_icq { return (shift->{"type"} eq "icq"); } -
t/completion.t
ra7250ee r4fd3c04 293 293 294 294 test_complete('type ', '', 295 [qw[admin aimzephyr]],295 [qw[admin zephyr]], 296 296 \&complete_filter_expr); 297 297 -
variable.c
r03fbf66 r4fd3c04 161 161 "Enable printing of login notifications", 162 162 "When this is enabled, BarnOwl will print login and logout notifications\n" 163 "for AIM, zephyr,or other protocols. If disabled BarnOwl will not print\n"163 "for zephyr or other protocols. If disabled BarnOwl will not print\n" 164 164 "login or logout notifications.\n"); 165 165 … … 233 233 "default zaway message", "" ); 234 234 235 OWLVAR_BOOL_FULL( "aaway" /* %OwlVarStub */, 0,236 "Set AIM away status",237 "",238 NULL, owl_variable_aaway_set, NULL);239 240 OWLVAR_STRING( "aaway_msg" /* %OwlVarStub */,241 OWL_DEFAULT_AAWAYMSG,242 "AIM away msg for responding when away", "" );243 244 OWLVAR_STRING( "aaway_msg_default" /* %OwlVarStub */,245 OWL_DEFAULT_AAWAYMSG,246 "default AIM away message", "" );247 248 235 OWLVAR_STRING( "view_home" /* %OwlVarStub */, "all", 249 236 "home view to switch to after 'X' and 'V'", … … 288 275 "Zephyr messages be no wider than 70 columns.\n"); 289 276 290 OWLVAR_INT( "aim_ignorelogin_timer" /* %OwlVarStub */, 15,291 "number of seconds after AIM login to ignore login messages",292 "This specifies the number of seconds to wait after an\n"293 "AIM login before allowing the receipt of AIM login notifications.\n"294 "By default this is set to 15. If you would like to view login\n"295 "notifications of buddies as soon as you login, set it to 0 instead.");296 297 298 277 OWLVAR_INT_FULL( "typewinsize" /* %OwlVarStub:typwin_lines */, 299 278 OWL_TYPWIN_SIZE, … … 461 440 } 462 441 463 /* When 'aaway' is changed, need to notify the AIM server */464 int owl_variable_aaway_set(owl_variable *v, bool newval)465 {466 if (newval) {467 owl_aim_set_awaymsg(owl_global_get_aaway_msg(&g));468 } else {469 owl_aim_set_awaymsg("");470 }471 return owl_variable_bool_set_default(v, newval);472 }473 474 442 int owl_variable_colorztext_set(owl_variable *v, bool newval) 475 443 {
Note: See TracChangeset
for help on using the changeset viewer.