Mercurial > pidgin.yaz
comparison libpurple/protocols/msn/command.c @ 20311:66b73b0def79
This asked me to do a 3way merge in vim. Someone should check it.
applied changes from 614efd22968bb59c279872f991d97f3053ded4f0
through cbefbdeb71c4fe12f131d0932abeaf81bea091cb
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Fri, 19 Oct 2007 17:18:40 +0000 |
parents | 44b4e8bd759b |
children | 8e54d39743cd |
comparison
equal
deleted
inserted
replaced
20310:311000f10bb0 | 20311:66b73b0def79 |
---|---|
34 } | 34 } |
35 | 35 |
36 return TRUE; | 36 return TRUE; |
37 } | 37 } |
38 | 38 |
39 /* | |
40 * check the command is the command with payload content | |
41 * if it is return TRUE | |
42 * else return FALSE | |
43 */ | |
44 static gboolean | |
45 msn_check_payload_cmd(const char *str) | |
46 { | |
47 g_return_val_if_fail(str != NULL, FALSE); | |
48 if( (!strcmp(str,"ADL")) || | |
49 (!strcmp(str,"GCF")) || | |
50 (!strcmp(str,"SG")) || | |
51 (!strcmp(str,"MSG")) || | |
52 (!strcmp(str,"RML")) || | |
53 (!strcmp(str,"UBX")) || | |
54 (!strcmp(str,"UBN")) || | |
55 (!strcmp(str,"UUM")) || | |
56 (!strcmp(str,"UBM")) || | |
57 (!strcmp(str,"FQY")) || | |
58 (!strcmp(str,"UUN")) || | |
59 (!strcmp(str,"UUX")) || | |
60 (is_num(str))){ | |
61 return TRUE; | |
62 } | |
63 | |
64 return FALSE; | |
65 } | |
66 | |
67 /* | |
68 * set command Payload length | |
69 */ | |
70 static void | |
71 msn_set_payload_len(MsnCommand *cmd) | |
72 { | |
73 char *param; | |
74 int len = 0; | |
75 | |
76 if (msn_check_payload_cmd(cmd->command) && (cmd->param_count > 0)){ | |
77 param = cmd->params[cmd->param_count - 1]; | |
78 len = is_num(param) ? atoi(param) : 0; | |
79 } | |
80 | |
81 cmd->payload_len = len; | |
82 } | |
83 | |
84 | |
39 MsnCommand * | 85 MsnCommand * |
40 msn_command_from_string(const char *string) | 86 msn_command_from_string(const char *string) |
41 { | 87 { |
42 MsnCommand *cmd; | 88 MsnCommand *cmd; |
43 char *tmp; | 89 char *tmp; |
68 param = cmd->params[0]; | 114 param = cmd->params[0]; |
69 | 115 |
70 cmd->trId = is_num(param) ? atoi(param) : 0; | 116 cmd->trId = is_num(param) ? atoi(param) : 0; |
71 } | 117 } |
72 else | 118 else |
119 { | |
73 cmd->trId = 0; | 120 cmd->trId = 0; |
121 } | |
122 | |
123 /*add payload Length checking*/ | |
124 msn_set_payload_len(cmd); | |
125 purple_debug_info("MSNP14","get payload len:%d\n",cmd->payload_len); | |
74 | 126 |
75 msn_command_ref(cmd); | 127 msn_command_ref(cmd); |
76 | 128 |
77 return cmd; | 129 return cmd; |
78 } | 130 } |