Mercurial > pidgin
changeset 30760:9429f30001f6
Replace magic numbers with the enumed SlpHeaderFlag.
author | masca@cpw.pidgin.im |
---|---|
date | Wed, 02 Jun 2010 09:01:12 +0000 |
parents | 35771ce2db52 |
children | 712c8ddcf5ed |
files | libpurple/protocols/msn/slp.c libpurple/protocols/msn/slpcall.c libpurple/protocols/msn/slplink.c |
diffstat | 3 files changed, 31 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/msn/slp.c Wed Jun 02 09:00:21 2010 +0000 +++ b/libpurple/protocols/msn/slp.c Wed Jun 02 09:01:12 2010 +0000 @@ -518,7 +518,7 @@ /* DATA */ slpmsg = msn_slpmsg_new(slplink); slpmsg->slpcall = slpcall; - slpmsg->flags = 0x20; + slpmsg->flags = SLP_HF_MSN_OBJ_DATA; slpmsg->info = "SLP DATA"; msn_slpmsg_set_image(slpmsg, img); msn_slplink_queue_slpmsg(slplink, slpmsg);
--- a/libpurple/protocols/msn/slpcall.c Wed Jun 02 09:00:21 2010 +0000 +++ b/libpurple/protocols/msn/slpcall.c Wed Jun 02 09:01:12 2010 +0000 @@ -204,7 +204,7 @@ body = slpmsg->buffer; body_len = slpmsg->offset; - if (slpmsg->flags == 0x0 || slpmsg->flags == 0x1000000) + if (slpmsg->flags == SLP_HF_NO_FLAG || slpmsg->flags == SLP_HF_WML2009_COMP) { char *body_str; @@ -265,9 +265,9 @@ } g_free(body_str); } - else if (slpmsg->flags == 0x20 || - slpmsg->flags == 0x1000020 || - slpmsg->flags == 0x1000030) + else if (slpmsg->flags == SLP_HF_MSN_OBJ_DATA || + slpmsg->flags == SLP_HF_WML2009_COMP & SLP_HF_MSN_OBJ_DATA || + slpmsg->flags == SLP_HF_FILE_DATA) { slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->session_id); @@ -293,7 +293,7 @@ msn_slpcall_session_init(slpcall); } #endif - else if (slpmsg->flags == 0x2) + else if (slpmsg->flags == SLP_HF_ACK) { /* Acknowledgement of previous message. Don't do anything currently. */ }
--- a/libpurple/protocols/msn/slplink.c Wed Jun 02 09:00:21 2010 +0000 +++ b/libpurple/protocols/msn/slplink.c Wed Jun 02 09:01:12 2010 +0000 @@ -294,7 +294,7 @@ * reusing the same one all the time. */ msg = slpmsg->msg; - real_size = (slpmsg->flags == 0x2) ? 0 : slpmsg->size; + real_size = (slpmsg->flags == SLP_HF_ACK) ? 0 : slpmsg->size; if (slpmsg->offset < real_size) { @@ -329,8 +329,9 @@ g_list_append(slpmsg->msgs, msn_message_ref(msg)); msn_slplink_send_msg(slplink, msg); - if ((slpmsg->flags == 0x20 || slpmsg->flags == 0x1000020 || - slpmsg->flags == 0x1000030) && + if ((slpmsg->flags == SLP_HF_MSN_OBJ_DATA || + slpmsg->flags == (SLP_HF_WML2009_COMP & SLP_HF_MSN_OBJ_DATA) || + slpmsg->flags == SLP_HF_FILE_DATA) && (slpmsg->slpcall != NULL)) { slpmsg->slpcall->progress = TRUE; @@ -354,7 +355,7 @@ slpmsg = data; - real_size = (slpmsg->flags == 0x2) ? 0 : slpmsg->size; + real_size = (slpmsg->flags == SLP_HF_ACK) ? 0 : slpmsg->size; slpmsg->offset += msg->msnslp_header.length; @@ -374,8 +375,9 @@ else { /* The whole message has been sent */ - if (slpmsg->flags == 0x20 || - slpmsg->flags == 0x1000020 || slpmsg->flags == 0x1000030) + if (slpmsg->flags == SLP_HF_MSN_OBJ_DATA || + slpmsg->flags == (SLP_HF_WML2009_COMP & SLP_HF_MSN_OBJ_DATA) || + slpmsg->flags == SLP_HF_FILE_DATA) { if (slpmsg->slpcall != NULL) { @@ -411,20 +413,21 @@ slpmsg->msg = msg = msn_message_new_msnslp(); - if (slpmsg->flags == 0x0) + if (slpmsg->flags == SLP_HF_NO_FLAG) { msg->msnslp_header.session_id = slpmsg->session_id; msg->msnslp_header.ack_id = rand() % 0xFFFFFF00; } - else if (slpmsg->flags == 0x2) + else if (slpmsg->flags == SLP_HF_ACK) { msg->msnslp_header.session_id = slpmsg->session_id; msg->msnslp_header.ack_id = slpmsg->ack_id; msg->msnslp_header.ack_size = slpmsg->ack_size; msg->msnslp_header.ack_sub_id = slpmsg->ack_sub_id; } - else if (slpmsg->flags == 0x20 || - slpmsg->flags == 0x1000020 || slpmsg->flags == 0x1000030) + else if (slpmsg->flags == SLP_HF_MSN_OBJ_DATA || + slpmsg->flags == (SLP_HF_WML2009_COMP & SLP_HF_MSN_OBJ_DATA) || + slpmsg->flags == SLP_HF_FILE_DATA) { MsnSlpCall *slpcall; slpcall = slpmsg->slpcall; @@ -497,7 +500,7 @@ slpmsg->session_id = header->session_id; slpmsg->size = header->total_size; - slpmsg->flags = 0x02; + slpmsg->flags = SLP_HF_ACK; slpmsg->ack_id = header->id; slpmsg->ack_sub_id = header->ack_id; slpmsg->ack_size = header->total_size; @@ -535,7 +538,7 @@ slpmsg = msn_slpmsg_new(slpcall->slplink); slpmsg->slpcall = slpcall; - slpmsg->flags = 0x1000030; + slpmsg->flags = SLP_HF_FILE_DATA; slpmsg->info = "SLP FILE"; slpmsg->size = purple_xfer_get_size(xfer); @@ -588,8 +591,9 @@ slpmsg->slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->session_id); if (slpmsg->slpcall != NULL) { - if (slpmsg->flags == 0x20 || - slpmsg->flags == 0x1000020 || slpmsg->flags == 0x1000030) + if (slpmsg->flags == SLP_HF_MSN_OBJ_DATA || + slpmsg->flags == (SLP_HF_WML2009_COMP & SLP_HF_MSN_OBJ_DATA) || + slpmsg->flags == SLP_HF_FILE_DATA) { PurpleXfer *xfer = slpmsg->slpcall->xfer; if (xfer != NULL) @@ -653,8 +657,9 @@ } } - if ((slpmsg->flags == 0x20 || - slpmsg->flags == 0x1000020 || slpmsg->flags == 0x1000030) && + if ((slpmsg->flags == SLP_HF_MSN_OBJ_DATA || + slpmsg->flags == (SLP_HF_WML2009_COMP & SLP_HF_MSN_OBJ_DATA) || + slpmsg->flags == SLP_HF_FILE_DATA) && (slpmsg->slpcall != NULL)) { slpmsg->slpcall->progress = TRUE; @@ -695,9 +700,10 @@ msn_directconn_send_handshake(directconn); #endif } - else if (slpmsg->flags == 0x00 || slpmsg->flags == 0x1000000 || - slpmsg->flags == 0x20 || slpmsg->flags == 0x1000020 || - slpmsg->flags == 0x1000030) + else if (slpmsg->flags == SLP_HF_NO_FLAG || slpmsg->flags == SLP_HF_WML2009_COMP || + slpmsg->flags == SLP_HF_MSN_OBJ_DATA || + slpmsg->flags == (SLP_HF_WML2009_COMP & SLP_HF_MSN_OBJ_DATA) || + slpmsg->flags == SLP_HF_FILE_DATA) { /* Release all the messages and send the ACK */