- Timestamp:
- Mar 28, 2009, 5:00:34 PM (16 years ago)
- Branches:
- owl
- Children:
- 4de643d
- Parents:
- 5189631
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
aim.c
r9854278 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 <stdio.h> 2 26 #include <stdio.h> … … 239 263 { 240 264 if (message) { 241 owl_function_error( message);265 owl_function_error("%s", message); 242 266 } else { 243 267 owl_function_error("Authentication error on login"); … … 948 972 949 973 if (modname) { 950 if (!(filename = malloc(strlen(priv->aimbinarypath)+1+strlen(modname)+4+1))) {974 if (!(filename = owl_malloc(strlen(priv->aimbinarypath)+1+strlen(modname)+4+1))) { 951 975 /* perror("memrequest: malloc"); */ 952 976 return -1; … … 954 978 sprintf(filename, "%s/%s.ocm", priv->aimbinarypath, modname); 955 979 } else { 956 if (!(filename = malloc(strlen(priv->aimbinarypath)+1+strlen(defaultmod)+1))) {980 if (!(filename = owl_malloc(strlen(priv->aimbinarypath)+1+strlen(defaultmod)+1))) { 957 981 /* perror("memrequest: malloc"); */ 958 982 return -1; … … 964 988 if (!modname) { 965 989 /* perror("memrequest: stat"); */ 966 free(filename);990 owl_free(filename); 967 991 return -1; 968 992 } … … 986 1010 int i; 987 1011 988 free(filename); /* not needed */1012 owl_free(filename); /* not needed */ 989 1013 owl_function_error("getaimdata memrequest: recieved invalid request for 0x%08lx bytes at 0x%08lx (file %s)\n", len, offset, modname); 990 1014 i = 8; … … 993 1017 } 994 1018 995 if (!(buf = malloc(i))) {1019 if (!(buf = owl_malloc(i))) { 996 1020 return -1; 997 1021 } … … 1017 1041 *buflenret = i; 1018 1042 } else { 1019 if (!(buf = malloc(len))) {1020 free(filename);1043 if (!(buf = owl_malloc(len))) { 1044 owl_free(filename); 1021 1045 return -1; 1022 1046 } … … 1024 1048 if (!(f = fopen(filename, "r"))) { 1025 1049 /* perror("memrequest: fopen"); */ 1026 free(filename);1027 free(buf);1050 owl_free(filename); 1051 owl_free(buf); 1028 1052 return -1; 1029 1053 } 1030 1054 1031 free(filename);1055 owl_free(filename); 1032 1056 1033 1057 if (fseek(f, offset, SEEK_SET) == -1) { 1034 1058 /* perror("memrequest: fseek"); */ 1035 1059 fclose(f); 1036 free(buf);1060 owl_free(buf); 1037 1061 return -1; 1038 1062 } … … 1041 1065 /* perror("memrequest: fread"); */ 1042 1066 fclose(f); 1043 free(buf);1067 owl_free(buf); 1044 1068 return -1; 1045 1069 } … … 1076 1100 if (priv->aimbinarypath && (getaimdata(sess, &buf, &buflen, offset, len, modname) == 0)) { 1077 1101 aim_sendmemblock(sess, fr->conn, offset, buflen, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST); 1078 free(buf);1102 owl_free(buf); 1079 1103 } else { 1080 1104 owl_function_debugmsg("faimtest_memrequest: unable to use AIM binary (\"%s/%s\"), sending defaults...\n", priv->aimbinarypath, modname); … … 1342 1366 int z; 1343 1367 1344 newbuf = malloc(i+1);1368 newbuf = owl_malloc(i+1); 1345 1369 for (z = 0; z < i; z++) 1346 1370 newbuf[z] = (z % 10)+0x30; 1347 1371 newbuf[i] = '\0'; 1348 1372 /* aim_send_im(sess, userinfo->sn, AIM_IMFLAGS_ACK | AIM_IMFLAGS_AWAY, newbuf); */ 1349 free(newbuf);1373 owl_free(newbuf); 1350 1374 } 1351 1375 } else if (strstr(tmpstr, "seticqstatus")) { … … 1452 1476 * 1453 1477 */ 1454 strncpy(realmsg, args->msg, sizeof(realmsg)); 1478 if (!args->msg) { 1479 if (args->mpmsg.parts->data) { 1480 strncpy(realmsg,args->mpmsg.parts->data, sizeof(realmsg)); 1481 } else { 1482 strncpy(realmsg,"",1); 1483 } 1484 } else { 1485 strncpy(realmsg, args->msg, sizeof(realmsg)); 1486 } 1455 1487 } 1456 1488 … … 1697 1729 1698 1730 /* printf("snac threw error (reason 0x%04x: %s)\n", reason, (reason<msgerrreasonslen)?msgerrreasons[reason]:"unknown"); */ 1699 if (reason<msgerrreasonslen) owl_function_error( msgerrreasons[reason]);1731 if (reason<msgerrreasonslen) owl_function_error("%s", msgerrreasons[reason]); 1700 1732 1701 1733 return 1; … … 1714 1746 1715 1747 /* printf("message to %s bounced (reason 0x%04x: %s)\n", destsn, reason, (reason<msgerrreasonslen)?msgerrreasons[reason]:"unknown"); */ 1716 if (reason<msgerrreasonslen) owl_function_error( msgerrreasons[reason]);1748 if (reason<msgerrreasonslen) owl_function_error("%s", msgerrreasons[reason]); 1717 1749 1718 1750 if (reason==4) { … … 1735 1767 1736 1768 /* printf("user information for %s unavailable (reason 0x%04x: %s)\n", destsn, reason, (reason<msgerrreasonslen)?msgerrreasons[reason]:"unknown"); */ 1737 if (reason<msgerrreasonslen) owl_function_error( msgerrreasons[reason]);1769 if (reason<msgerrreasonslen) owl_function_error("%s", msgerrreasons[reason]); 1738 1770 1739 1771 return 1; … … 2310 2342 } 2311 2343 2344 void owl_process_aim() 2345 { 2346 if (owl_global_is_doaimevents(&g)) { 2347 owl_aim_process_events(); 2348 } 2349 } 2312 2350 2313 2351 /**********************************************************************************/
Note: See TracChangeset
for help on using the changeset viewer.