- Timestamp:
- Mar 28, 2009, 5:00:34 PM (15 years ago)
- Branches:
- owl
- Children:
- 4de643d
- Parents:
- 5189631
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
zwrite.c
rdb2dd3d rdab82f29 1 /* Copyright (c) 2002,2003,2004,2009 James M. Kretchmar 2 * 3 * This file is part of Owl. 4 * 5 * Owl is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * Owl is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with Owl. If not, see <http://www.gnu.org/licenses/>. 17 * 18 * --------------------------------------------------------------- 19 * 20 * As of Owl version 2.1.12 there are patches contributed by 21 * developers of the the branched BarnOwl project, Copyright (c) 22 * 2006-2008 The BarnOwl Developers. All rights reserved. 23 */ 24 1 25 #include <string.h> 2 26 #include <pwd.h> … … 191 215 { 192 216 int i, j; 193 char to[LINE];217 char *to; 194 218 195 219 if (z->noping) return; … … 205 229 for (i=0; i<j; i++) { 206 230 if (strcmp(z->realm, "")) { 207 sprintf(to,"%s@%s", (char *) owl_list_get_element(&(z->recips), i), z->realm);231 to = owl_sprintf("%s@%s", (char *) owl_list_get_element(&(z->recips), i), z->realm); 208 232 } else { 209 strcpy(to,owl_list_get_element(&(z->recips), i));233 to = owl_strdup(owl_list_get_element(&(z->recips), i)); 210 234 } 211 235 send_ping(to); 236 owl_free(to); 212 237 } 213 238 … … 217 242 { 218 243 int i, j; 219 char toline[LINE]; 220 244 char *toline = NULL; 245 char *tmp = NULL; 246 221 247 if (z->message) owl_free(z->message); 222 248 223 249 j=owl_list_get_size(&(z->recips)); 224 250 if (j>0 && z->cc) { 225 strcpy(toline,"CC: ");251 toline = owl_strdup( "CC: "); 226 252 for (i=0; i<j; i++) { 253 tmp = toline; 227 254 if (strcmp(z->realm, "")) { 228 sprintf(toline,"%s%s@%s ", toline, (char *) owl_list_get_element(&(z->recips), i), z->realm);255 toline = owl_sprintf( "%s%s@%s ", toline, (char *) owl_list_get_element(&(z->recips), i), z->realm); 229 256 } else { 230 sprintf(toline, "%s%s ", toline, (char *) owl_list_get_element(&(z->recips), i)); 231 } 257 toline = owl_sprintf( "%s%s ", toline, (char *) owl_list_get_element(&(z->recips), i)); 258 } 259 owl_free(tmp); 260 tmp=NULL; 232 261 } 233 262 z->message=owl_sprintf("%s\n%s", toline, msg); 263 owl_free(toline); 234 264 } else { 235 265 z->message=owl_strdup(msg); … … 252 282 { 253 283 int i, j; 254 char to[LINE];284 char *to = NULL; 255 285 256 286 if (z->message==NULL) return(-1); … … 260 290 for (i=0; i<j; i++) { 261 291 if (strcmp(z->realm, "")) { 262 sprintf(to,"%s@%s", (char *) owl_list_get_element(&(z->recips), i), z->realm);292 to = owl_sprintf("%s@%s", (char *) owl_list_get_element(&(z->recips), i), z->realm); 263 293 } else { 264 strcpy(to,owl_list_get_element(&(z->recips), i));294 to = owl_strdup( owl_list_get_element(&(z->recips), i)); 265 295 } 266 296 send_zephyr(z->opcode, z->zsig, z->class, z->inst, to, z->message); 297 owl_free(to); 298 to = NULL; 267 299 } 268 300 } else { 269 sprintf(to,"@%s", z->realm);301 to = owl_sprintf( "@%s", z->realm); 270 302 send_zephyr(z->opcode, z->zsig, z->class, z->inst, to, z->message); 271 303 } 304 owl_free(to); 272 305 return(0); 273 306 }
Note: See TracChangeset
for help on using the changeset viewer.