|
|
|
@ -13,3 +13,25 @@ char* fetch_dest_user_string(char* message) {
|
|
|
|
|
|
|
|
|
|
return token;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char* fetch_sender_user_string(char* message) {
|
|
|
|
|
fetch_generic_string("IAM",message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char* fetch_generic_string(char* indicator, char* message) {
|
|
|
|
|
char* token = malloc (sizeof(char) * strlen(message));
|
|
|
|
|
|
|
|
|
|
char* string_to_search = malloc(strlen(indicator) + 1);
|
|
|
|
|
strcpy(string_to_search,indicator);
|
|
|
|
|
strcat(string_to_search,":");
|
|
|
|
|
|
|
|
|
|
token = strtok(message," r\n");
|
|
|
|
|
if (strcmp(token,string_to_search) == 0) {
|
|
|
|
|
token = strtok(NULL," \r\n");
|
|
|
|
|
} else {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return token;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|