@@ -2179,8 +2179,8 @@ static int me_minst(int argc, char **argv, int sockd) try
21792179 uint64_t message_id;
21802180 char sql_string[1024 ];
21812181
2182- uint8_t b_unsent = strchr (argv[4 ], ' U ' ) != nullptr ;
2183- uint8_t b_read = strchr (argv[4 ], ' S ' ) != nullptr ;
2182+ uint8_t b_unsent = strchr (argv[4 ], midb_flag::unsent ) != nullptr ;
2183+ uint8_t b_read = strchr (argv[4 ], midb_flag::seen ) != nullptr ;
21842184 auto eml_path = make_eml_path (argv[1 ], argv[3 ]);
21852185 size_t slurp_size = 0 ;
21862186 std::unique_ptr<char [], stdlib_delete> pbuff (HX_slurp_file (eml_path.c_str (), &slurp_size));
@@ -2805,19 +2805,19 @@ static int simu_query(IDB_ITEM *pidb, const char *sql_string,
28052805 sn.uid = pstmt.col_int64 (2 );
28062806 sn.flags = " (" ;
28072807 if (pstmt.col_int64 (3 ) != 0 )
2808- sn.flags += ' A ' ;
2808+ sn.flags += midb_flag::answered ;
28092809 if (pstmt.col_int64 (4 ) != 0 )
2810- sn.flags += ' U ' ;
2810+ sn.flags += midb_flag::unsent ;
28112811 if (pstmt.col_int64 (5 ) != 0 )
2812- sn.flags += ' F ' ;
2812+ sn.flags += midb_flag::flagged ;
28132813 if (pstmt.col_int64 (6 ) != 0 )
2814- sn.flags += ' D ' ;
2814+ sn.flags += midb_flag::deleted ;
28152815 if (pstmt.col_int64 (7 ) != 0 )
2816- sn.flags += ' S ' ;
2816+ sn.flags += midb_flag::seen ;
28172817 if (pstmt.col_int64 (8 ) != 0 )
2818- sn.flags += ' R ' ;
2818+ sn.flags += midb_flag::recent ;
28192819 if (pstmt.col_int64 (9 ) != 0 )
2820- sn.flags += ' W ' ;
2820+ sn.flags += midb_flag::forwarded ;
28212821 sn.flags += ' )' ;
28222822 sn.size = pstmt.col_uint64 (10 );
28232823 temp_list.push_back (std::move (sn));
@@ -3107,12 +3107,12 @@ static int me_psflg(int argc, char **argv, int sockd)
31073107 return MIDB_E_NO_MESSAGE;
31083108 message_id = sqlite3_column_int64 (pstmt, 0 );
31093109 pstmt.finalize ();
3110- if (NULL != strchr (argv[4 ], ' A ' ) ) {
3110+ if (strchr (argv[4 ], midb_flag::answered) != nullptr ) {
31113111 snprintf (sql_string, std::size (sql_string), " UPDATE messages SET replied=1"
31123112 " WHERE message_id=%llu" , LLU{message_id});
31133113 gx_sql_exec (pidb->psqlite , sql_string);
31143114 }
3115- if (NULL != strchr (argv[4 ], ' U ' ) ) {
3115+ if (strchr (argv[4 ], midb_flag::unsent) != nullptr ) {
31163116 static constexpr proptag_t tmp_proptag[] = {PR_MESSAGE_FLAGS};
31173117 static constexpr PROPTAG_ARRAY proptags = {std::size (tmp_proptag), deconst (tmp_proptag)};
31183118 if (!exmdb_client::get_message_properties (argv[1 ], NULL ,
@@ -3129,26 +3129,26 @@ static int me_psflg(int argc, char **argv, int sockd)
31293129 return MIDB_E_MDB_SETMSGPROPS;
31303130 }
31313131 }
3132- if (NULL != strchr (argv[4 ], ' F ' ) ) {
3132+ if (strchr (argv[4 ], midb_flag::flagged) != nullptr ) {
31333133 snprintf (sql_string, std::size (sql_string), " UPDATE messages SET flagged=1"
31343134 " WHERE message_id=%llu" , LLU{message_id});
31353135 gx_sql_exec (pidb->psqlite , sql_string);
31363136 }
3137- if (NULL != strchr (argv[4 ], ' W ' ) ) {
3137+ if (strchr (argv[4 ], midb_flag::forwarded) != nullptr ) {
31383138 snprintf (sql_string, std::size (sql_string), " UPDATE messages SET forwarded=1"
31393139 " WHERE message_id=%llu" , LLU{message_id});
31403140 gx_sql_exec (pidb->psqlite , sql_string);
31413141 }
3142- if (NULL != strchr (argv[4 ], ' D ' ) ) {
3142+ if (strchr (argv[4 ], midb_flag::deleted) != nullptr ) {
31433143 snprintf (sql_string, std::size (sql_string), " UPDATE messages SET deleted=1"
31443144 " WHERE message_id=%llu" , LLU{message_id});
31453145 gx_sql_exec (pidb->psqlite , sql_string);
31463146 }
3147- if (strchr (argv[4 ], ' S ' ) != nullptr &&
3147+ if (strchr (argv[4 ], midb_flag::seen ) != nullptr &&
31483148 !exmdb_client::set_message_read_state (argv[1 ], nullptr ,
31493149 rop_util_make_eid_ex (1 , message_id), 1 , &read_cn))
31503150 return MIDB_E_MDB_SETMSGRD;
3151- if (NULL != strchr (argv[4 ], ' R ' ) ) {
3151+ if (strchr (argv[4 ], midb_flag::recent) != nullptr ) {
31523152 snprintf (sql_string, std::size (sql_string), " UPDATE messages SET recent=1"
31533153 " WHERE message_id=%llu" , LLU{message_id});
31543154 gx_sql_exec (pidb->psqlite , sql_string);
@@ -3189,12 +3189,12 @@ static int me_prflg(int argc, char **argv, int sockd)
31893189 return MIDB_E_NO_MESSAGE;
31903190 message_id = sqlite3_column_int64 (pstmt, 0 );
31913191 pstmt.finalize ();
3192- if (NULL != strchr (argv[4 ], ' A ' )) {
3192+ if (NULL != strchr (argv[4 ], midb_flag::answered )) {
31933193 snprintf (sql_string, std::size (sql_string), " UPDATE messages SET replied=0"
31943194 " WHERE message_id=%llu" , LLU{message_id});
31953195 gx_sql_exec (pidb->psqlite , sql_string);
31963196 }
3197- if (NULL != strchr (argv[4 ], ' U ' ) ) {
3197+ if (strchr (argv[4 ], midb_flag::unsent) != nullptr ) {
31983198 static constexpr proptag_t tmp_proptag[] = {PR_MESSAGE_FLAGS};
31993199 static constexpr PROPTAG_ARRAY proptags = {std::size (tmp_proptag), deconst (tmp_proptag)};
32003200 if (!exmdb_client::get_message_properties (argv[1 ], nullptr ,
@@ -3211,26 +3211,26 @@ static int me_prflg(int argc, char **argv, int sockd)
32113211 return MIDB_E_MDB_SETMSGPROPS;
32123212 }
32133213 }
3214- if (NULL != strchr (argv[4 ], ' F ' ) ) {
3214+ if (strchr (argv[4 ], midb_flag::flagged) != nullptr ) {
32153215 snprintf (sql_string, std::size (sql_string), " UPDATE messages SET flagged=0"
32163216 " WHERE message_id=%llu" , LLU{message_id});
32173217 gx_sql_exec (pidb->psqlite , sql_string);
32183218 }
3219- if (NULL != strchr (argv[4 ], ' W ' ) ) {
3219+ if (strchr (argv[4 ], midb_flag::forwarded) != nullptr ) {
32203220 snprintf (sql_string, std::size (sql_string), " UPDATE messages SET forwarded=0"
32213221 " WHERE message_id=%llu" , LLU{message_id});
32223222 gx_sql_exec (pidb->psqlite , sql_string);
32233223 }
3224- if (NULL != strchr (argv[4 ], ' D ' ) ) {
3224+ if (strchr (argv[4 ], midb_flag::deleted) != nullptr ) {
32253225 snprintf (sql_string, std::size (sql_string), " UPDATE messages SET deleted=0"
32263226 " WHERE message_id=%llu" , LLU{message_id});
32273227 gx_sql_exec (pidb->psqlite , sql_string);
32283228 }
3229- if (strchr (argv[4 ], ' S ' ) != nullptr &&
3229+ if (strchr (argv[4 ], midb_flag::seen ) != nullptr &&
32303230 !exmdb_client::set_message_read_state (argv[1 ], nullptr ,
32313231 rop_util_make_eid_ex (1 , message_id), 0 , &read_cn))
32323232 return MIDB_E_MDB_SETMSGRD;
3233- if (NULL != strchr (argv[4 ], ' R ' ) ) {
3233+ if (strchr (argv[4 ], midb_flag::recent) != nullptr ) {
32343234 snprintf (sql_string, std::size (sql_string), " UPDATE messages SET recent=0"
32353235 " WHERE message_id=%llu" , LLU{message_id});
32363236 gx_sql_exec (pidb->psqlite , sql_string);
@@ -3270,13 +3270,13 @@ static int me_pgflg(int argc, char **argv, int sockd) try
32703270 gx_sql_col_uint64 (pstmt, 0 ) != folder_id)
32713271 return MIDB_E_NO_MESSAGE;
32723272 std::string ans = " TRUE (" ;
3273- if (pstmt.col_int64 (5 ) != 0 ) ans += ' A ' ;
3274- if (pstmt.col_int64 (3 ) != 0 ) ans += ' U ' ;
3275- if (pstmt.col_int64 (4 ) != 0 ) ans += ' F ' ;
3276- if (pstmt.col_int64 (6 ) != 0 ) ans += ' W ' ;
3277- if (pstmt.col_int64 (7 ) != 0 ) ans += ' D ' ;
3278- if (pstmt.col_int64 (2 ) != 0 ) ans += ' S ' ;
3279- if (pstmt.col_int64 (1 ) != 0 ) ans += ' R ' ;
3273+ if (pstmt.col_int64 (5 ) != 0 ) ans += midb_flag::answered ;
3274+ if (pstmt.col_int64 (3 ) != 0 ) ans += midb_flag::unsent ;
3275+ if (pstmt.col_int64 (4 ) != 0 ) ans += midb_flag::flagged ;
3276+ if (pstmt.col_int64 (6 ) != 0 ) ans += midb_flag::forwarded ;
3277+ if (pstmt.col_int64 (7 ) != 0 ) ans += midb_flag::deleted ;
3278+ if (pstmt.col_int64 (2 ) != 0 ) ans += midb_flag::seen ;
3279+ if (pstmt.col_int64 (1 ) != 0 ) ans += midb_flag::recent ;
32803280 pstmt.finalize ();
32813281 pidb.reset ();
32823282 ans += " )\r\n " ;
@@ -3567,17 +3567,17 @@ static void notif_msg_added(IDB_ITEM *pidb,
35673567 me_insert_message (pstmt, &uidnext, message_id,
35683568 syncmessage_entry{mod_time, received_time, message_flags, str});
35693569 pstmt.finalize ();
3570- if (flags_buff.find (' F ' ) != flags_buff.npos ) {
3570+ if (flags_buff.find (midb_flag::flagged ) != flags_buff.npos ) {
35713571 qstr = fmt::format (" UPDATE messages SET "
35723572 " flagged=1 WHERE message_id={}" , message_id);
35733573 gx_sql_exec (pidb->psqlite , qstr.c_str ());
35743574 }
3575- if (flags_buff.find (' A ' ) != flags_buff.npos ) {
3575+ if (flags_buff.find (midb_flag::answered ) != flags_buff.npos ) {
35763576 qstr = fmt::format (" UPDATE messages SET "
35773577 " replied=1 WHERE message_id={}" , message_id);
35783578 gx_sql_exec (pidb->psqlite , qstr.c_str ());
35793579 }
3580- if (flags_buff.find (' W ' ) != flags_buff.npos ) {
3580+ if (flags_buff.find (midb_flag::forwarded ) != flags_buff.npos ) {
35813581 qstr = fmt::format (" UPDATE messages SET "
35823582 " forwarded=1 WHERE message_id={}" , message_id);
35833583 gx_sql_exec (pidb->psqlite , qstr.c_str ());
0 commit comments