| 242 | } |
| 243 | |
| 244 | void net_store::load_mail_db(acl::db_handle& db) |
| 245 | { |
| 246 | acl::string sql; |
| 247 | sql.format("select smtp_addr, smtp_port, pop3_addr, pop3_port, user, pass, recipients from mail_tbl"); |
| 248 | if (db.sql_select(sql.c_str()) == false) |
| 249 | { |
| 250 | logger_error("sql(%s) error", sql.c_str()); |
| 251 | return; |
| 252 | } |
| 253 | |
| 254 | const acl::db_row* first_row = db.get_first_row(); |
| 255 | if (first_row == NULL) |
| 256 | return; |
| 257 | const char* ptr = (*first_row)["smtp_addr"]; |
| 258 | if (ptr) |
| 259 | smtp_addr_ = ptr; |
| 260 | ptr = (*first_row)["smtp_port"]; |
| 261 | |
| 262 | int n; |
| 263 | if (ptr && (n = atoi(ptr)) > 0) |
| 264 | smtp_port_ = n; |
| 265 | |
| 266 | ptr = (*first_row)["pop3_addr"]; |
| 267 | if (ptr) |
| 268 | pop3_addr_ = ptr; |
| 269 | |
| 270 | ptr = (*first_row)["pop3_port"]; |
| 271 | if (ptr && (n = atoi(ptr)) > 0) |
| 272 | pop3_port_ = n; |
| 273 | |
| 274 | ptr = (*first_row)["user"]; |
| 275 | if (ptr) |
| 276 | user_ = ptr; |
| 277 | |
| 278 | ptr = (*first_row)["pass"]; |
| 279 | if (ptr) |
| 280 | { |
| 281 | // �Լ��ܵ�������Ҫ�Ƚ��� |
| 282 | char* pass_plain = passwd_decrypt(ptr); |
| 283 | if (pass_plain) |
| 284 | { |
| 285 | pass_ = pass_plain; |
| 286 | acl_myfree(pass_plain); |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | ptr = (*first_row)["recipients"]; |
| 291 | if (ptr) |
| 292 | recipients_ = ptr; |
| 293 | } |
nothing calls this directly
no test coverage detected