- Timestamp:
- 2009-01-07T01:56:18Z (16 years ago)
- Branches:
- master
- Children:
- 9580a6f
- Parents:
- 607f5e3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
skype/skype.c
r607f5e3 rff436ba 33 33 #define SKYPE_DEFAULT_SERVER "localhost" 34 34 #define SKYPE_DEFAULT_PORT "2727" 35 #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) 35 36 36 37 /* … … 817 818 } 818 819 820 typedef void (*skype_parser)(struct im_connection *ic, char *line); 821 819 822 static gboolean skype_read_callback(gpointer data, gint fd, 820 823 b_input_condition cond) … … 823 826 struct skype_data *sd = ic->proto_data; 824 827 char buf[1024]; 825 int st ;828 int st, i; 826 829 char **lines, **lineptr, *line; 830 static struct parse_map { 831 char *k; 832 skype_parser v; 833 } parsers[] = { 834 { "USERS ", skype_parse_users }, 835 { "USER ", skype_parse_user }, 836 { "CHATMESSAGE ", skype_parse_chatmessage }, 837 { "CALL ", skype_parse_call }, 838 { "FILETRANSFER ", skype_parse_filetransfer }, 839 { "CHAT ", skype_parse_chat }, 840 { "PASSWORD ", skype_parse_password }, 841 { "PROFILE PSTN_BALANCE ", skype_parse_profile }, 842 { "PING", skype_parse_ping }, 843 { "CHATS ", skype_parse_chats }, 844 }; 827 845 828 846 if (!sd || sd->fd == -1) … … 840 858 if (set_getbool(&ic->acc->set, "skypeconsole_receive")) 841 859 imcb_buddy_msg(ic, "skypeconsole", line, 0, 0); 842 if (!strncmp(line, "USERS ", 6)) 843 skype_parse_users(ic, line); 844 else if (!strncmp(line, "USER ", 5)) 845 skype_parse_user(ic, line); 846 else if (!strncmp(line, "CHATMESSAGE ", 12)) 847 skype_parse_chatmessage(ic, line); 848 else if (!strncmp(line, "CALL ", 5)) 849 skype_parse_call(ic, line); 850 else if (!strncmp(line, "FILETRANSFER ", 13)) 851 skype_parse_filetransfer(ic, line); 852 else if (!strncmp(line, "CHAT ", 5)) 853 skype_parse_chat(ic, line); 854 else if (!strncmp(line, "PASSWORD ", 9)) 855 skype_parse_password(ic, line); 856 else if (!strncmp(line, "PROFILE PSTN_BALANCE ", 21)) 857 skype_parse_profile(ic, line); 858 else if (!strncmp(line, "PING", 4)) 859 skype_parse_ping(ic, line); 860 else if (!strncmp(line, "CHATS ", 6)) 861 skype_parse_chats(ic, line); 860 for (i = 0; i < ARRAY_SIZE(parsers); i++) { 861 if (!strncmp(line, parsers[i].k, strlen(parsers[i].k))) { 862 parsers[i].v(ic, line); 863 break; 864 } 865 } 862 866 lineptr++; 863 867 }
Note: See TracChangeset
for help on using the changeset viewer.