Changeset 56330ff
- Timestamp:
- Aug 25, 2002, 3:02:14 PM (22 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:
- c01e477
- Parents:
- 4b464a4
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
ChangeLog
r4b464a4 r56330ff 16 16 Renamed pretty_sender to short_zuser and renamed long_sender to 17 17 long_zuser 18 Moved zsig generation to the zwrite object 19 Print the zsig used for outgoing messages 18 20 19 21 1.2.2 -
functions.c
r4b464a4 r56330ff 80 80 } 81 81 82 void owl_function_make_outgoing_zephyr(char *header, char *body, char *zwriteline ) {82 void owl_function_make_outgoing_zephyr(char *header, char *body, char *zwriteline, char *zsig) { 83 83 owl_message *m; 84 84 int followlast; … … 94 94 * Right now this only works for one recipient */ 95 95 tobuff=owl_malloc(strlen(owl_zwrite_get_recip_n(&z, 0))+100); 96 sprintf(tobuff, "Zephyr sent to %s ", owl_zwrite_get_recip_n(&z, 0));96 sprintf(tobuff, "Zephyr sent to %s (Zsig: %s)", owl_zwrite_get_recip_n(&z, 0), zsig); 97 97 98 98 /* create the message */ … … 129 129 owl_global_set_needrefresh(&g); 130 130 owl_free(tobuff); 131 owl_zwrite_free(&z); 131 132 } 132 133 … … 153 154 /* create and setup the editwin */ 154 155 e=owl_global_get_typwin(&g); 155 owl_editwin_new_style(e, OWL_EDITWIN_STYLE_MULTILINE, 156 owl_global_get_msg_history(&g)); 156 owl_editwin_new_style(e, OWL_EDITWIN_STYLE_MULTILINE, owl_global_get_msg_history(&g)); 157 157 158 158 if (!owl_global_get_lockout_ctrld(&g)) { … … 183 183 owl_function_makemsg("Waiting for ack..."); 184 184 185 /* display the message as an adminmessage in the receive window */185 /* display the message as an outgoing message in the receive window */ 186 186 if (owl_global_is_displayoutgoing(&g) && owl_zwrite_is_personal(&z)) { 187 187 owl_zwrite_get_recipstr(&z, buff); 188 188 tmpbuff = owl_sprintf("Message sent to %s", buff); 189 owl_function_make_outgoing_zephyr(tmpbuff, owl_editwin_get_text(owl_global_get_typwin(&g)), line );189 owl_function_make_outgoing_zephyr(tmpbuff, owl_editwin_get_text(owl_global_get_typwin(&g)), line, owl_zwrite_get_zsig(&z)); 190 190 owl_free(tmpbuff); 191 191 } -
owl.h
r4b464a4 r56330ff 219 219 char realm[LINE]; 220 220 char opcode[LINE]; 221 char *zsig; 221 222 owl_list recips; 222 223 int cc; -
zephyr.c
r4b464a4 r56330ff 6 6 #include <zephyr/zephyr.h> 7 7 #include <com_err.h> 8 #include <pwd.h>9 8 #include "owl.h" 10 9 … … 259 258 int ret; 260 259 ZNotice_t notice; 261 char *ptr;262 struct passwd *pw;263 char zsigtmp[LINE];264 char *zsigexec, *zsigowlvar, *zsigzvar;265 266 zsigexec = owl_global_get_zsig_exec(&g);267 zsigowlvar = owl_global_get_zsig(&g);268 zsigzvar = ZGetVariable("zwrite-signature");269 270 if (zsig) {271 strcpy(zsigtmp, zsig);272 } else if (zsigowlvar && *zsigowlvar) {273 strncpy(zsigtmp, zsigowlvar, LINE);274 } else if (zsigexec && *zsigexec) {275 FILE *file;276 char buff[LINE];277 strcpy(zsigtmp, "");278 file=popen(zsigexec, "r");279 if (!file) {280 if (zsigzvar && *zsigzvar) {281 strncpy(zsigtmp, zsigzvar, LINE);282 }283 } else {284 while (fgets(buff, LINE, file)) { /* wrong sizing */285 strcat(zsigtmp, buff);286 }287 pclose(file);288 if (zsigtmp[strlen(zsigtmp)-1]=='\n') {289 zsigtmp[strlen(zsigtmp)-1]='\0';290 }291 }292 } else if (zsigzvar) {293 strncpy(zsigtmp, zsigzvar, LINE);294 } else if (((pw=getpwuid(getuid()))!=NULL) && (pw->pw_gecos)) {295 strncpy(zsigtmp, pw->pw_gecos, LINE);296 ptr=strchr(zsigtmp, ',');297 if (ptr) {298 ptr[0]='\0';299 }300 } else {301 strcpy(zsigtmp, "");302 }303 260 304 261 memset(¬ice, 0, sizeof(notice)); … … 317 274 if (opcode) notice.z_opcode=opcode; 318 275 319 notice.z_message_len=strlen(zsig tmp)+1+strlen(message);276 notice.z_message_len=strlen(zsig)+1+strlen(message); 320 277 notice.z_message=owl_malloc(notice.z_message_len+10); 321 strcpy(notice.z_message, zsig tmp);322 memcpy(notice.z_message+strlen(zsig tmp)+1, message, strlen(message));278 strcpy(notice.z_message, zsig); 279 memcpy(notice.z_message+strlen(zsig)+1, message, strlen(message)); 323 280 324 281 /* ret=ZSendNotice(¬ice, ZAUTH); */ -
zwrite.c
r4b464a4 r56330ff 1 1 #include <string.h> 2 #include <pwd.h> 3 #include <sys/types.h> 4 #include <unistd.h> 2 5 #include "owl.h" 3 6 … … 17 20 int argc, badargs, myargc; 18 21 char **argv, **myargv; 22 char *zsigexec, *zsigowlvar, *zsigzvar, *ptr; 23 struct passwd *pw; 19 24 20 25 badargs=0; … … 25 30 strcpy(z->inst, "personal"); 26 31 strcpy(z->opcode, ""); 32 z->zsig=owl_strdup(""); 27 33 z->cc=0; 28 34 z->noping=0; … … 103 109 } 104 110 111 /* set a zsig */ 112 zsigexec = owl_global_get_zsig_exec(&g); 113 zsigowlvar = owl_global_get_zsig(&g); 114 zsigzvar = ZGetVariable("zwrite-signature"); 115 116 if (zsigowlvar && *zsigowlvar) { 117 owl_free(z->zsig); 118 z->zsig=strdup(zsigowlvar); 119 } else if (zsigexec && *zsigexec) { 120 FILE *file; 121 char buff[LINE]; 122 123 file=popen(zsigexec, "r"); 124 if (!file) { 125 if (zsigzvar && *zsigzvar) { 126 owl_free(z->zsig); 127 z->zsig=owl_strdup(zsigzvar); 128 } 129 } else { 130 owl_free(z->zsig); 131 z->zsig=owl_malloc(LINE); 132 strcpy(z->zsig, ""); 133 while (fgets(buff, LINE, file)) { /* wrong sizing */ 134 strcat(z->zsig, buff); 135 } 136 pclose(file); 137 if (z->zsig[strlen(z->zsig)-1]=='\n') { 138 z->zsig[strlen(z->zsig)-1]='\0'; 139 } 140 } 141 } else if (zsigzvar) { 142 owl_free(z->zsig); 143 z->zsig=owl_strdup(zsigzvar); 144 } else if (((pw=getpwuid(getuid()))!=NULL) && (pw->pw_gecos)) { 145 owl_free(z->zsig); 146 z->zsig=strdup(pw->pw_gecos); 147 ptr=strchr(z->zsig, ','); 148 if (ptr) { 149 ptr[0]='\0'; 150 } 151 } 152 105 153 return(0); 106 154 } … … 160 208 } 161 209 if (z->cc) { 162 send_zephyr(z->opcode, NULL, z->class, z->inst, to, tmpmsg);210 send_zephyr(z->opcode, z->zsig, z->class, z->inst, to, tmpmsg); 163 211 } else { 164 send_zephyr(z->opcode, NULL, z->class, z->inst, to, msg);212 send_zephyr(z->opcode, z->zsig, z->class, z->inst, to, msg); 165 213 } 166 214 } … … 190 238 } 191 239 240 char *owl_zwrite_get_zsig(owl_zwrite *z) { 241 return(z->zsig); 242 } 243 192 244 void owl_zwrite_get_recipstr(owl_zwrite *z, char *buff) { 193 245 int i, j; … … 225 277 void owl_zwrite_free(owl_zwrite *z) { 226 278 owl_list_free_all(&(z->recips), &owl_free); 227 } 279 owl_free(z->zsig); 280 }
Note: See TracChangeset
for help on using the changeset viewer.