summaryrefslogtreecommitdiff
path: root/member.c
blob: 74f416c8e97c7f1894564f14ffdab302b977ecc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#include <stdlib.h>
#include <stdbool.h>
#include "login.h"
#include "icclient/member.h"

void icclient_member_newaccount(const char *username, const char *password, const char *verify,
		void (*handler)(icclient_response *), void (*callback)(struct icclient_member *))
{
	login(username, password, verify, "NewAccount", handler, (void (*)(void *))callback);
}

void icclient_member_login(const char *username, const char *password, void (*handler)(icclient_response *),
		void (*callback)(struct icclient_member *))
{
	login(username, password, NULL, "Login", handler, (void (*)(void *))callback);
}

void icclient_member_account(const char *fname, const char *lname, const char *address1,
		const char *address2, const char *city, const char *state,
		const char *zip, const char *email, const char *phone_day)
{
	request(NULL, NULL, &(struct body){ 13, {
			{ "mv_form_profile", "account_change" },
			{ "mv_todo", "return" },
			{ "mv_nextpage", "member/account" },
			{ "mv_check", "Save_database" },
			{ "fname", fname },
			{ "lname", lname },
			{ "address1", address1 },
			{ "address2", address2 },
			{ "city", city },
			{ "state", state },
			{ "zip", zip },
			{ "email", email },
			{ "phone_day", phone_day }
			}}, "%s", "process");
}

void icclient_member_changepassword(const char *password_old, const char *password, const char *verify)
{
	request(NULL, NULL, &(struct body){ 6, {
			{ "mv_action", "return" },
			{ "mv_check", "Change_password" },
			{ "mv_successpage", "member/service" },
			{ "mv_password_old", password_old },
			{ "mv_password", password },
			{ "mv_verify", verify }
			}}, "%s", "member/change_password");
}

void icclient_member_logout(struct icclient_member *member)
{
	request(NULL, NULL, NULL, "%s", "logout");
	if (member->username)
		free(member->username);
	if (member->usernick)
		free(member->usernick);
	if (member->password)
		free(member->password);
	if (member->expiration)
		free(member->expiration);
	if (member->acl)
		free(member->acl);
	if (member->mod_time)
		free(member->mod_time);
	if (member->s_nickname)
		free(member->s_nickname);
	if (member->company)
		free(member->company);
	if (member->fname)
		free(member->fname);
	if (member->lname)
		free(member->lname);
	if (member->address1)
		free(member->address1);
	if (member->address2)
		free(member->address2);
	if (member->address3)
		free(member->address3);
	if (member->city)
		free(member->city);
	if (member->state)
		free(member->state);
	if (member->zip)
		free(member->zip);
	if (member->country)
		free(member->country);
	if (member->phone_day)
		free(member->phone_day);
	if (member->mv_shipmode)
		free(member->mv_shipmode);
	if (member->b_nickname)
		free(member->b_nickname);
	if (member->b_fname)
		free(member->b_fname);
	if (member->b_lname)
		free(member->b_lname);
	if (member->b_company)
		free(member->b_company);
	if (member->b_address1)
		free(member->b_address1);
	if (member->b_address2)
		free(member->b_address2);
	if (member->b_address3)
		free(member->b_address3);
	if (member->b_city)
		free(member->b_city);
	if (member->b_state)
		free(member->b_state);
	if (member->b_zip)
		free(member->b_zip);
	if (member->b_country)
		free(member->b_country);
	if (member->b_phone)
		free(member->b_phone);
	if (member->p_nickname)
		free(member->p_nickname);
	if (member->email)
		free(member->email);
	if (member->fax)
		free(member->fax);
	if (member->phone_night)
		free(member->phone_night);
	if (member->address_book)
		free(member->address_book);
	if (member->accounts)
		free(member->accounts);
	if (member->preferences)
		free(member->preferences);
	if (member->carts)
		free(member->carts);
	if (member->owner)
		free(member->owner);
	if (member->file_acl)
		free(member->file_acl);
	if (member->db_acl)
		free(member->db_acl);
	if (member->mail_list)
		free(member->mail_list);
	if (member->credit_limit)
		free(member->credit_limit);
	if (member->price_level)
		free(member->price_level);
	free(member);
}