Changeset d09e5a1 for functions.c
- Timestamp:
- May 31, 2003, 3:33:42 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:
- 5e53c4a
- Parents:
- c86a35c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
functions.c
r801c7cb rd09e5a1 10 10 #include <sys/wait.h> 11 11 #include <errno.h> 12 #include <signal.h> 12 13 #include "owl.h" 13 14 … … 124 125 } 125 126 127 void owl_function_make_outgoing_aim(char *body, char *to) 128 { 129 owl_message *m; 130 int followlast; 131 132 followlast=owl_global_should_followlast(&g); 133 134 /* create the message */ 135 m=owl_malloc(sizeof(owl_message)); 136 owl_message_create_aim(m, owl_global_get_aim_screenname(&g), body); 137 owl_message_set_recipient(m, to); 138 owl_message_set_direction_out(m); 139 140 /* add it to the global list and current view */ 141 owl_messagelist_append_element(owl_global_get_msglist(&g), m); 142 owl_view_consider_message(owl_global_get_current_view(&g), m); 143 144 if (followlast) owl_function_lastmsg_noredisplay(); 145 146 owl_mainwin_redisplay(owl_global_get_mainwin(&g)); 147 if (owl_popwin_is_active(owl_global_get_popwin(&g))) { 148 owl_popwin_refresh(owl_global_get_popwin(&g)); 149 } 150 151 wnoutrefresh(owl_global_get_curs_recwin(&g)); 152 owl_global_set_needrefresh(&g); 153 } 154 126 155 void owl_function_zwrite_setup(char *line) 127 156 { … … 166 195 } 167 196 197 void owl_function_aimwrite_setup(char *line) 198 { 199 owl_editwin *e; 200 char buff[1024]; 201 202 /* check the arguments */ 203 204 /* create and setup the editwin */ 205 e=owl_global_get_typwin(&g); 206 owl_editwin_new_style(e, OWL_EDITWIN_STYLE_MULTILINE, owl_global_get_msg_history(&g)); 207 208 if (!owl_global_get_lockout_ctrld(&g)) { 209 owl_function_makemsg("Type your message below. End with ^D or a dot on a line by itself. ^C will quit."); 210 } else { 211 owl_function_makemsg("Type your message below. End with a dot on a line by itself. ^C will quit."); 212 } 213 214 owl_editwin_clear(e); 215 owl_editwin_set_dotsend(e); 216 strcpy(buff, "----> "); 217 strcat(buff, line); 218 strcat(buff, "\n"); 219 owl_editwin_set_locktext(e, buff); 220 221 /* make it active */ 222 owl_global_set_typwin_active(&g); 223 } 224 225 226 168 227 void owl_function_zcrypt_setup(char *line) 169 228 { … … 241 300 owl_zwrite_free(&z); 242 301 } 302 303 304 void owl_function_aimwrite(char *to) 305 { 306 /* send the message */ 307 owl_aim_send_im(to, owl_editwin_get_text(owl_global_get_typwin(&g))); 308 owl_function_makemsg("AIM message sent."); 309 310 /* display the message as an outgoing message in the receive window */ 311 if (owl_global_is_displayoutgoing(&g)) { 312 owl_function_make_outgoing_aim(owl_editwin_get_text(owl_global_get_typwin(&g)), to); 313 } 314 315 /* not yet */ 316 #if 0 317 /* log it if we have logging turned on */ 318 if (owl_global_is_logging(&g)) { 319 owl_log_outgoing(to, owl_editwin_get_text(owl_global_get_typwin(&g))); 320 } 321 #endif 322 } 323 243 324 244 325 … … 619 700 ret = owl_config_execute("owl::shutdown();"); 620 701 if (ret) owl_free(ret); 702 703 /* signal our child process, if any */ 704 if (owl_global_get_newmsgproc_pid(&g)) { 705 kill(owl_global_get_newmsgproc_pid(&g), SIGHUP); 706 } 621 707 622 708 /* final clean up */ … … 1005 1091 buff=owl_global_get_buffercommand(&g); 1006 1092 if (!strncmp(buff, "zwrite ", 7)) { 1007 1008 1093 owl_function_zwrite(buff); 1094 } else if (!strncmp(buff, "aimwrite ", 9)) { 1095 owl_function_aimwrite(buff+9); 1009 1096 } 1010 1097 } … … 1193 1280 } else if (owl_message_is_type_generic(m)) { 1194 1281 owl_fmtext_append_normal(&fm, "Type : generic\n"); 1282 } else if (owl_message_is_type_aim(m)) { 1283 owl_fmtext_append_normal(&fm, "Type : aim\n"); 1195 1284 } else { 1196 1285 owl_fmtext_append_normal(&fm, "Type : unknown\n"); … … 1680 1769 } 1681 1770 1682 /* for now we disable replies to zcrypt messages, since we can't 1683 support an encrypted reply */ 1684 if (!strcasecmp(owl_message_get_opcode(m), "crypt")) { 1685 owl_function_makemsg("Replies to zcrypt messages are not enabled in this release"); 1771 /* admin */ 1772 if (owl_message_is_type_admin(m)) { 1773 owl_function_makemsg("You cannot reply to an admin message"); 1686 1774 return; 1687 1775 } 1688 1776 1689 if (owl_message_is_direction_out(m)) { 1690 owl_function_zwrite_setup(owl_message_get_zwriteline(m)); 1691 owl_global_set_buffercommand(&g, owl_message_get_zwriteline(m)); 1692 } else if (owl_message_is_type_admin(m)) { 1693 owl_function_makemsg("You cannot reply to an admin message"); 1694 } else { 1777 /* zephyr */ 1778 if (owl_message_is_type_zephyr(m)) { 1779 /* for now we disable replies to zcrypt messages, since we can't 1780 support an encrypted reply */ 1781 if (!strcasecmp(owl_message_get_opcode(m), "crypt")) { 1782 owl_function_makemsg("Replies to zcrypt messages are not enabled in this release"); 1783 return; 1784 } 1785 1786 if (owl_message_is_direction_out(m)) { 1787 owl_function_zwrite_setup(owl_message_get_zwriteline(m)); 1788 owl_global_set_buffercommand(&g, owl_message_get_zwriteline(m)); 1789 return; 1790 } 1791 1695 1792 if (owl_message_is_login(m)) { 1696 1793 class="MESSAGE"; … … 1714 1811 } 1715 1812 } 1716 1813 1717 1814 /* create the command line */ 1718 1815 buff = owl_strdup("zwrite"); … … 1745 1842 } 1746 1843 if (cc) owl_free(cc); 1747 1748 if (enter) { 1749 owl_history *hist = owl_global_get_cmd_history(&g); 1750 owl_history_store(hist, buff); 1751 owl_history_reset(hist); 1752 owl_function_command_norv(buff); 1753 } else { 1754 owl_function_start_command(buff); 1755 } 1756 owl_free(buff); 1757 } 1844 } 1845 1846 /* aim */ 1847 if (owl_message_is_type_aim(m)) { 1848 buff=owl_sprintf("aimwrite %s", owl_message_get_sender(m)); 1849 } 1850 1851 if (enter) { 1852 owl_history *hist = owl_global_get_cmd_history(&g); 1853 owl_history_store(hist, buff); 1854 owl_history_reset(hist); 1855 owl_function_command_norv(buff); 1856 } else { 1857 owl_function_start_command(buff); 1858 } 1859 owl_free(buff); 1758 1860 } 1759 1861 }
Note: See TracChangeset
for help on using the changeset viewer.