about summary refs log tree commit diff stats
path: root/src/xmpp/session.c
Commit message (Collapse)AuthorAgeFilesLines
* Apply coding styleMichael Vetter2020-07-071-34/+34
|
* Revert "Apply coding style"Michael Vetter2020-07-071-45/+45
| | | | | | This reverts commit 9b55f2dec0ea27a9ce4856e303425e12f866cea2. Sorting the includes creates some problems.
* Apply coding styleMichael Vetter2020-07-071-45/+45
| | | | Regards https://github.com/profanity-im/profanity/issues/1396
* Remove prefs_free_string()Michael Vetter2020-07-021-3/+3
| | | | | It just does a free. Related to b580b9ef119045f142fa4baa9689a1c5ce8864ef
* Add option for legacy authenticationDmitry Podgorny2020-06-051-5/+14
| | | | | | | | New options: /connect <account> [auth default|legacy] /account <account> set auth default|legacy Fixes #1236.
* Add vim modelineMichael Vetter2019-11-131-0/+1
|
* Call message_handlers_clear() upon disconnectMichael Vetter2019-06-201-0/+1
| | | | Free pubsub_event_handlers. Fix memory leaks.
* Call iq_handlers_clear() upon disconnectMichael Vetter2019-06-201-0/+1
| | | | Free id_handlers. Fix memory leaks.
* Don't clear saved account data in session_disconnect()Dmitry Podgorny2019-06-031-28/+7
| | | | | | | | | | | | | | | | | | | | If connection loss occurs, it calls session_disconnect() eventually. This function clears saved account data which is required for reconnection. Therefore, when reconnect timer expires, we get errors: 02/06/2019 04:53:42: stderr: ERR: (profanity:17115): GLib-CRITICAL **: 04:53:42.305: g_key_file_has_group: assertion 'group_name != NULL' failed 02/06/2019 04:53:43: prof: ERR: Unable to reconnect, account no longer exists: (null) To solve it, don't clear the saved data in session_disconnect(). It will be cleared properly on connection loss if reconnect timer is not configured. But won't be cleared with /disconnect command. So, after /disconnect the data will live in memory until the next /connect. Also, remove some copy-paste in connection loss path.
* Add random string at the end of the default resourcePaul Fariello2019-04-121-1/+3
| | | | | | | | When connecting for the first time or when creating a new account don't use only 'profanity' as default resource. Some server don't support having 2 connection with same resource. Using profanity as default lead to deconnections.
* Wait for discovery end to publish omemo devicelist and bundlePaul Fariello2019-04-101-1/+1
| | | | Add sv_ev_connection_features_received for that purpose
* Ensure saved_account is set before calling sv_ev_login_account_successPaul Fariello2019-04-101-1/+1
|
* device_list iq should be from barejid or nonePaul Fariello2019-04-101-12/+6
| | | | | | | Ensure we request device_list and remove non conforming handling of responses. Move initialisation of iq_handlers before call to sv_ev_login_account_success
* Fix devicelist subscription and handle pubsub eventPaul Fariello2019-04-101-1/+1
| | | | Devicelist subscription can be done directly with caps_add feature.
* Add devicelist and bundle publicationPaul Fariello2019-04-101-1/+5
|
* Add devicelist subscriptionPaul Fariello2019-04-101-0/+7
|
* Update copyright to include 2019Michael Vetter2019-01-221-1/+1
|
* Clear rooms cache on disconnectJames Booth2018-02-051-0/+2
|
* Update copyrightJames Booth2018-01-211-1/+1
|
* Update CopyrightJames Booth2017-01-281-1/+1
|
* Remove status from cl_ev_presence_sendJames Booth2017-01-151-8/+14
| | | | fixes #888
* Allow clearing account resourceJames Booth2016-11-221-7/+20
| | | | issue #880
* Handle NULL saved_statusJames Booth2016-07-271-1/+5
|
* Copy curr_status and free original in session.cJames Booth2016-07-271-1/+2
|
* Free ProfAccountJames Booth2016-07-251-0/+1
|
* Move autoaway checkJames Booth2016-07-241-0/+141
|
* Tidy headersJames Booth2016-07-241-5/+5
|
* Move event timeout to connection moduleJames Booth2016-07-241-9/+2
|
* Update GPL link in headersJames Booth2016-07-241-1/+1
|
* Add connection_set_disconnected()James Booth2016-05-111-8/+13
|
* Add connection_clear_data()James Booth2016-05-101-13/+7
|
* Remove connection_free_conn(), connection_free_ctx()James Booth2016-05-101-6/+6
|
* Add connection_shutdown()James Booth2016-05-101-4/+1
|
* Remove JABBER_STARTED, JABBER_UNDEFINED connection statesJames Booth2016-05-101-15/+4
|
* Remove _session_free_session_data from session.cJames Booth2016-05-101-38/+42
|
* Fixed compileJames Booth2016-05-081-1/+1
|
* Tidy session.cJames Booth2016-05-081-3/+4
|
* Free features on disconnectJames Booth2016-05-081-0/+1
|
* Move conneciton initialisation to _connection_handlerJames Booth2016-05-081-5/+0
|
* Move xmpp_initialise() to conneciton.cJames Booth2016-05-071-1/+0
|
* Move disco info struct to connectionJames Booth2016-05-071-51/+2
|
* Move available resources to connection structJames Booth2016-05-071-21/+1
|
* Remove redundant tls secured functionJames Booth2016-05-061-1/+1
|
* Tidy connect functionJames Booth2016-05-061-3/+3
|
* Move connection_connectJames Booth2016-05-061-36/+3
|
* Move send stanza functionJames Booth2016-05-061-11/+0
|
* Move conn is secure functionJames Booth2016-05-061-10/+0
|
* Move tls peer cert functionJames Booth2016-05-061-24/+0
|
* Move uuid functionsJames Booth2016-05-061-14/+0
|
* Move connection fulljid functionJames Booth2016-05-061-9/+3
|
i">360; l = l - i * 360.0; return l; } double moon_position(double j, double ls) { double ms, l, mm, n, ev, sms, z, x, lm, bm, ae, ec, d, ds, as, dm; int i; /* ls = sun_position(j) */ ms = 0.985647332099 * j - 3.762863; if(ms < 0) ms += 360.0; l = 13.176396 * j + 64.975464; i = l / 360; l = l - i * 360.0; if(l < 0) l += 360.0; mm = l - 0.1114041 * j - 349.383063; i = mm / 360; mm -= i * 360.0; n = 151.950429 - 0.0529539 * j; i = n / 360; n -= i * 360.0; ev = 1.2739 * sin((2 * (l - ls) - mm) * RAD); sms = sin(ms * RAD); ae = 0.1858 * sms; mm += ev - ae - 0.37 * sms; ec = 6.2886 * sin(mm * RAD); l += ev + ec - ae + 0.214 * sin(2 * mm * RAD); l = 0.6583 * sin(2 * (l - ls) * RAD) + l; return l; } double moon_phase(int year, int month, int day, double hour, int *ip) { double j = Julian(year, month, (double)day + hour / 24.0) - 2444238.5; double ls = sun_position(j); double lm = moon_position(j, ls); double t = lm - ls; if(t < 0) t += 360; *ip = (int)((t + 22.5) / 45) & 0x7; return (1.0 - cos((lm - ls) * RAD)) / 2; } static void nextDay(int *y, int *m, int *d, double dd) { TimePlace tp; double jd = Julian(*y, *m, (double)*d); jd += dd; JulianToDate(&tp, jd); *y = tp.year; *m = tp.month; *d = tp.day; } int main(int argc, char **argv) { int y, m, d, m0, h, i; int ymax, mmax, dmax, hmax; int ymin, mmin, dmin, hmin; int begun = 0; double step = 1; double pmax = 0; double pmin = 1; double plast = 0; time_t seconds = time(NULL); struct tm zt = {0}; struct tm *t = localtime(&seconds); if(t == NULL) t = &zt; printf("year[%d]: ", t->tm_year + 1900); fflush(stdout); scanf("%d", &y); printf("month[%d]: ", t->tm_mon + 1); fflush(stdout); scanf("%d", &m); d = 1; m0 = m; printf("\nDate Time Phase Segment\n"); for(;;) { double p; int ip; for(h = 0; h < 24; h += step) { p = moon_phase(y, m, d, h, &ip); if(begun) { if(p > plast && p > pmax) { pmax = p; ymax = y; mmax = m; dmax = d; hmax = h; } else if(pmax) { printf("%04d/%02d/%02d %02d:00 (fullest)\n", ymax, mmax, dmax, hmax); pmax = 0; } if(p < plast && p < pmin) { pmin = p; ymin = y; mmin = m; dmin = d; hmin = h; } else if(pmin < 1) { printf("%04d/%02d/%02d %02d:00 (newest)\n", ymin, mmin, dmin, hmin); pmin = 1.0; } if(h == 16) { printf("%04d/%02d/%02d %02d:00 %5.1f%% (%d)\n", y, m, d, h, floor(p * 1000 + 0.5) / 10, ip); } } else begun = 1; plast = p; } nextDay(&y, &m, &d, 1.0); if(m != m0) break; } return 0; }