| 73 |
73 |
| 74 /* decode the base64 payload */ |
74 /* decode the base64 payload */ |
| 75 link = (gchar*) purple_base64_decode( link64 + strlen( MXIT_LINK_PREFIX ), &len ); |
75 link = (gchar*) purple_base64_decode( link64 + strlen( MXIT_LINK_PREFIX ), &len ); |
| 76 purple_debug_info( MXIT_PLUGIN_ID, "Clicked Link: '%s'\n", link ); |
76 purple_debug_info( MXIT_PLUGIN_ID, "Clicked Link: '%s'\n", link ); |
| 77 |
77 |
| 78 parts = g_strsplit( link, "|", 5 ); |
78 parts = g_strsplit( link, "|", 6 ); |
| 79 |
79 |
| 80 /* check if this is a valid mxit link */ |
80 /* check if this is a valid mxit link */ |
| 81 if ( ( !parts ) || ( !parts[0] ) || ( !parts[1] ) || ( !parts[2] ) || ( !parts[3] ) || ( !parts[4] ) ) { |
81 if ( ( !parts ) || ( !parts[0] ) || ( !parts[1] ) || ( !parts[2] ) || ( !parts[3] ) || ( !parts[4] ) || ( !parts[5] ) ) { |
| 82 /* this is not for us */ |
82 /* this is not for us */ |
| 83 goto skip; |
83 goto skip; |
| 84 } |
84 } |
| 85 else if ( g_ascii_strcasecmp( parts[0], MXIT_LINK_KEY ) != 0 ) { |
85 else if ( g_ascii_strcasecmp( parts[0], MXIT_LINK_KEY ) != 0 ) { |
| 86 /* this is not for us */ |
86 /* this is not for us */ |
| 94 con = purple_account_get_connection( account ); |
94 con = purple_account_get_connection( account ); |
| 95 if ( !con ) |
95 if ( !con ) |
| 96 goto skip; |
96 goto skip; |
| 97 |
97 |
| 98 /* determine if it's a command-response to send */ |
98 /* determine if it's a command-response to send */ |
| 99 is_command = g_str_has_prefix( parts[4], "::type=reply|" ); |
99 is_command = ( atoi( parts[4] ) == 1 ); |
| 100 |
100 |
| 101 /* send click message back to MXit */ |
101 /* send click message back to MXit */ |
| 102 mxit_send_message( con->proto_data, parts[3], parts[4], FALSE, is_command ); |
102 mxit_send_message( con->proto_data, parts[3], parts[5], FALSE, is_command ); |
| 103 |
103 |
| 104 g_free( link ); |
104 g_free( link ); |
| 105 link = NULL; |
105 link = NULL; |
| 106 g_strfreev( parts ); |
106 g_strfreev( parts ); |
| 107 parts = NULL; |
107 parts = NULL; |