Changeset b45293f for readconfig.c
- Timestamp:
- Oct 11, 2002, 11:56:23 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:
- 68b41b0
- Parents:
- 2adaf1d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
readconfig.c
r4b464a4 rb45293f 62 62 /* create variables */ 63 63 perl_get_sv("owl::id", TRUE); 64 perl_get_sv("owl::type", TRUE); 65 perl_get_sv("owl::direction", TRUE); 64 66 perl_get_sv("owl::class", TRUE); 65 67 perl_get_sv("owl::instance", TRUE); … … 127 129 int i, j, len; 128 130 char *ptr, *ptr2; 129 ZNotice_t *n;130 131 131 132 if (!owl_global_have_config(&g)) return(""); 132 133 133 134 /* set owl::msg */ 134 n=owl_message_get_notice(m);135 ptr=owl_zephyr_get_message(n, &len);135 ptr=owl_message_get_body(m); 136 len=strlen(ptr); 136 137 ptr2=owl_malloc(len+20); 137 138 memcpy(ptr2, ptr, len); … … 144 145 145 146 /* set owl::zsig */ 146 ptr=owl_zephyr_get_zsig(n, &len); 147 ptr=owl_message_get_zsig(m); 148 len=strlen(ptr); 147 149 if (len>0) { 148 150 ptr2=owl_malloc(len+20); … … 165 167 } else { 166 168 sv_setpv(perl_get_sv("owl::type", TRUE), "unknown"); 169 } 170 171 /* set owl::direction */ 172 if (owl_message_is_direction_in(m)) { 173 sv_setpv(perl_get_sv("owl::direction", TRUE), "in"); 174 } else if (owl_message_is_direction_out(m)) { 175 sv_setpv(perl_get_sv("owl::direction", TRUE), "out"); 176 } else if (owl_message_is_direction_none(m)) { 177 sv_setpv(perl_get_sv("owl::direction", TRUE), "none"); 178 } else { 179 sv_setpv(perl_get_sv("owl::direction", TRUE), "unknown"); 167 180 } 168 181 … … 189 202 190 203 /* set owl::fields */ 191 av_clear(perl_get_av("owl::fields", TRUE)); 192 j=owl_zephyr_get_num_fields(n); 193 for (i=0; i<j; i++) { 194 ptr=owl_zephyr_get_field(n, i+1, &len); 195 ptr2=owl_malloc(len+10); 196 memcpy(ptr2, ptr, len); 197 ptr2[len]='\0'; 198 av_push(perl_get_av("owl::fields", TRUE), newSVpvn(ptr2, len)); 199 owl_free(ptr2); 204 if (owl_message_is_type_zephyr(m) && owl_message_is_direction_in(m)) { 205 av_clear(perl_get_av("owl::fields", TRUE)); 206 j=owl_zephyr_get_num_fields(owl_message_get_notice(m)); 207 for (i=0; i<j; i++) { 208 ptr=owl_zephyr_get_field(owl_message_get_notice(m), i+1, &len); 209 ptr2=owl_malloc(len+10); 210 memcpy(ptr2, ptr, len); 211 ptr2[len]='\0'; 212 av_push(perl_get_av("owl::fields", TRUE), newSVpvn(ptr2, len)); 213 owl_free(ptr2); 214 } 200 215 } 201 216 202 217 /* for backwards compatibilty, because I'm an idiot */ 203 av_clear(perl_get_av("fields", TRUE)); 204 j=owl_zephyr_get_num_fields(n); 205 for (i=0; i<j; i++) { 206 ptr=owl_zephyr_get_field(n, i+1, &len); 207 ptr2=owl_malloc(len+10); 208 memcpy(ptr2, ptr, len); 209 ptr2[len]='\0'; 210 av_push(perl_get_av("fields", TRUE), newSVpvn(ptr2, len)); 211 owl_free(ptr2); 218 if (owl_message_is_type_zephyr(m) && owl_message_is_direction_in(m)) { 219 av_clear(perl_get_av("fields", TRUE)); 220 j=owl_zephyr_get_num_fields(owl_message_get_notice(m)); 221 for (i=0; i<j; i++) { 222 ptr=owl_zephyr_get_field(owl_message_get_notice(m), i+1, &len); 223 ptr2=owl_malloc(len+10); 224 memcpy(ptr2, ptr, len); 225 ptr2[len]='\0'; 226 av_push(perl_get_av("fields", TRUE), newSVpvn(ptr2, len)); 227 owl_free(ptr2); 228 } 212 229 } 213 230
Note: See TracChangeset
for help on using the changeset viewer.