1 #ifndef LJ_H 2 #define LJ_H 3 4 #include <stdio.h> 5 #include "hash.h" 6 7 #define LJ_SUBJECT_MAX 256 8 9 /***************************************************************************** 10 * These are the different headers for the different LJ protocol modes. Eaach 11 * mode actually has its own .c file, but I didn't see a reason to make a whole 12 * bunch of .h files 13 */ 14 typedef struct _lj_server { 15 char *hostname; 16 char *path; 17 int port; 18 } lj_server; 19 20 typedef enum _auth_method 21 { 22 pwd_plain = 0x01, 23 pwd_hash = 0x02, 24 pwd_challenge = 0x03, 25 } auth_method_t; 26 27 typedef struct _lj_user { 28 char *username; 29 char *password; 30 auth_method_t auth_method; 31 char *auth; /* username and password */ 32 int fastserver; 33 int accesscount; 34 int userpiccount; 35 int frgrpcount; 36 int moodcount; 37 char **access; 38 char **userpic; 39 char **frgrps; 40 char **moods; 41 } lj_user; 42 43 /******************************** 44 ** In file: src/lj_postevent.c ** 45 ********************************/ 46 typedef struct _lj_event { 47 char *event; 48 char *subject; 49 char *security; 50 char *allowmask; 51 char *usejournal; 52 char *mood; 53 char *userpic; 54 char *music; 55 char *location; 56 char *taglist; 57 int moodid; 58 char dateback[13]; 59 int nocomments; 60 int preformatted; 61 int backdated; 62 int replace; 63 } lj_event; 64 65 typedef struct _lj_event_response { 66 int success; 67 char *message; /* either itemid or errmsg */ 68 } lj_event_response; 69 70 extern int lj_postevent (const lj_server *serverinfo, lj_user *user, 71 lj_event *post, lj_event_response *response ); 72 /***************************************************************************** 73 * This routine handles the postevent mode. 74 * 75 * the routine calculates the date on its own, lineendings is set to 76 * 'unix', and support for properties is not going to be included. 77 * Perhaps in a later version. 78 */ 79 80 81 /**************************** 82 ** In file: src/lj_login.c ** 83 ****************************/ 84 typedef enum _loginflag 85 { 86 getpickws = 0x0001, 87 getmenus = 0x0002, 88 } loginflag; 89 90 typedef struct _lj_logininfo { 91 /* stuff we send */ 92 char *clientversion; 93 loginflag loginflags; 94 char *mood; 95 int moodid; 96 char **userpics; 97 98 /* stuff we get back */ 99 int success; 100 char *errmsg; 101 char *name; 102 char *message; 103 } lj_logininfo; 104 105 extern int lj_login(const lj_server *serverinfo, lj_user *user, 106 lj_logininfo *logininfo); 107 /***************************************************************************** 108 * This routine handles the login mode 109 * 110 * The routine simply sends off the login request and gets back stuff like the 111 * keyword list 112 */ 113 114 /*********************************** 115 ** In file: src/lj_checkfriends.c ** 116 ***********************************/ 117 118 /* this struct is used for both checkfriends and editfriends */ 119 typedef struct _lj_friendninfo { 120 char *user; 121 char *name; 122 char *birthday; 123 char *bg; 124 char *fg; 125 int groupmask; 126 char *type; 127 char *status; 128 } lj_friendninfo; 129 130 typedef enum { NOTHING, ADD_FRIEND, DELETE_FRIEND } lj_editfriendflag; 131 132 /* this struct is used for both checkfriends and editfriends */ 133 typedef struct _lj_friendinfo { 134 /* stuff we send */ 135 lj_editfriendflag friendflags; 136 /* stuff we get back */ 137 int success; 138 char *errmsg; 139 int count; 140 lj_friendninfo *friends; 141 int focount; 142 lj_friendninfo *friendsof; 143 } lj_friendinfo; 144 145 extern int lj_getfriends(const lj_server *serverinfo, lj_user *user, 146 lj_friendinfo *friendinfo); 147 148 extern int lj_editfriends(const lj_server *serverinfo, lj_user *user, 149 lj_friendinfo *friendinfo); 150 151 /*********************************** 152 ** In file: src/lj_getevents.c ** 153 ***********************************/ 154 typedef struct _lj_eventninfo { 155 int itemid; 156 char *time; 157 char *event; 158 char *security; 159 int allowmask; 160 char *subject; 161 char *poster; 162 } lj_eventninfo; 163 164 typedef struct _lj_eventinfo { 165 /* stuff we send */ 166 int eventflags; 167 char *usejournal; 168 /* stuff we get back */ 169 int success; 170 char *errmsg; 171 int count; 172 lj_eventninfo *events; 173 } lj_eventinfo; 174 175 extern int lj_getevents(const lj_server *serverinfo, lj_user *user, 176 lj_eventinfo *eventinfo); 177 178 /*********************************** 179 ** In file: src/lj_getcomments.c ** 180 ***********************************/ 181 typedef struct _lj_commentninfo { 182 int itemid; 183 char *time; 184 char *poster; 185 char *subject; 186 char *comment; 187 int screened; 188 int parent; 189 } lj_commentninfo; 190 191 typedef struct _lj_commentinfo { 192 /* stuff we send */ 193 int commentflags; 194 int journalid; 195 char *usejournal; 196 /* stuff we get back */ 197 int success; 198 char *errmsg; 199 int count; 200 lj_commentninfo *comments; 201 } lj_commentinfo; 202 203 extern int lj_getcomments(const lj_server *serverinfo, lj_user *user, 204 lj_commentinfo *commentinfo); 205 206 typedef struct _lj_challengeinfo { 207 /* stuff we send */ 208 /* stuff we get back */ 209 int success; 210 char *errmsg; 211 char *auth_sceme; 212 char *challenge; 213 int expire_time; 214 int server_time; 215 } lj_challengeinfo; 216 217 extern int lj_getchallenge(const lj_server *serverinfo, const lj_user *user, 218 lj_challengeinfo *challengeinfo); 219 220 #endif /* LJ_H */ 221