- Timestamp:
- 2015-11-23T21:20:34Z (9 years ago)
- Branches:
- master
- Children:
- 1e2094e, 5b01e1a
- Parents:
- 9c8dbc7
- Location:
- protocols
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/nogaim.c
r9c8dbc7 rad9ac5d 90 90 91 91 GList *protocols = NULL; 92 GList *disabled_protocols = NULL; 92 93 93 94 void register_protocol(struct prpl *p) … … 103 104 104 105 if (refused) { 105 log_message(LOGLVL_WARNING, "Protocol %s disabled\n", p->name);106 disabled_protocols = g_list_append(disabled_protocols, p); 106 107 } else { 107 108 protocols = g_list_append(protocols, p); … … 109 110 } 110 111 112 static int proto_name_cmp(const void *proto_, const void *name) 113 { 114 const struct prpl *proto = proto_; 115 return g_strcasecmp(proto->name, name); 116 } 117 111 118 struct prpl *find_protocol(const char *name) 112 119 { 113 GList *gl; 114 115 for (gl = protocols; gl; gl = gl->next) { 116 struct prpl *proto = gl->data; 117 118 if (g_strcasecmp(proto->name, name) == 0) { 119 return proto; 120 } 121 } 122 123 return NULL; 120 GList *gl = g_list_find_custom(protocols, name, proto_name_cmp); 121 return gl ? gl->data: NULL; 122 } 123 124 gboolean is_protocol_disabled(const char *name) 125 { 126 return g_list_find_custom(disabled_protocols, name, proto_name_cmp) != NULL; 124 127 } 125 128 -
protocols/nogaim.h
r9c8dbc7 rad9ac5d 275 275 G_MODULE_EXPORT GSList *get_connections(); 276 276 G_MODULE_EXPORT struct prpl *find_protocol(const char *name); 277 G_MODULE_EXPORT gboolean is_protocol_disabled(const char *name); 277 278 /* When registering a new protocol, you should allocate space for a new prpl 278 279 * struct, initialize it (set the function pointers to point to your
Note: See TracChangeset
for help on using the changeset viewer.